Advertisement
mathmasterphil

Anti's Horse

Feb 22nd, 2015
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.73 KB | None | 0 0
  1. --[[
  2. PROJECT: Horse
  3. STARTDATE: 18/08/13
  4. CREDITS: Penjuin3 and AntiBoomz0r
  5. ]]
  6.  
  7. Breeds = {
  8.  
  9. {
  10. fur=BrickColor.new("Brown"),
  11. mane=BrickColor.new("Really black"),
  12. saddle=BrickColor.new("Reddish brown"),
  13. reins=BrickColor.new("Really black"),
  14. hoof=BrickColor.new("Really black")
  15. }
  16. }
  17.  
  18. local Breed = Breeds[math.random(1,#Breeds)]
  19.  
  20. local ModelName = "Horse"
  21. local ModelParent = workspace
  22. --pcall(function() ModelParent[ModelName]:Destroy() end)
  23.  
  24. local ReinsHold = nil
  25. local Height = 6.2
  26. local rHeight = Height
  27.  
  28. local HasHat = true
  29. local HatMeshId = "http://www.roblox.com/asset/?id=13640868"
  30. local HatTexId = ""
  31. local HorseColor = Breed.fur
  32. local EyeColor = BrickColor.new("Really black")
  33. local ManeColor = Breed.mane
  34. local SaddleColor = Breed.saddle
  35. local ReinsColor = Breed.reins
  36. local HoofColor = Breed.hoof
  37. local oc = oc or function(...) return ... end
  38. local ModelScale = 1
  39.  
  40. local Speed = 0
  41. local WalkSpeed = 15
  42. local WalkSin = 6
  43. local TrotSpeed = 30
  44. local TrotSin = 4
  45. local GallopSin = 18
  46. local MaxSpeed = 90
  47. local SpeedLimit = 100.5
  48.  
  49.  
  50. local startpos = workspace.mathmasterphil.Head.CFrame * CFrame.new(0,Height+1.5,10)--script.Parent:IsA("BasePart") and script.Parent.CFrame * CFrame.new(0,Height,0) or CFrame.new(0,Height+1,20)
  51.  
  52. math.randomseed(tick()+215819240)
  53. math.random() math.random() math.random()
  54. aran = function() return math.random() end
  55. ran = function() return (math.random()-.5)*2 end
  56.  
  57. function Weld(a,b,c,d)
  58. local w = Instance.new("Weld",a)
  59. w.Part0 = a
  60. w.Part1 = b
  61. w.C0 = c or CFrame.new()
  62. w.C1 = d or CFrame.new()
  63. return w
  64. end
  65.  
  66.  
  67. do -- Ignore my clerp stuff stolen from stravvy
  68. local function QuaternionFromCFrame(cf)
  69. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  70. local trace = m00 + m11 + m22
  71. if trace > 0 then
  72. local s = math.sqrt(1 + trace)
  73. local recip = 0.5/s
  74. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  75. else
  76. local i = 0
  77. if m11 > m00 then
  78. i = 1
  79. end
  80. if m22 > (i == 0 and m00 or m11) then
  81. i = 2
  82. end
  83. if i == 0 then
  84. local s = math.sqrt(m00-m11-m22+1)
  85. local recip = 0.5/s
  86. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  87. elseif i == 1 then
  88. local s = math.sqrt(m11-m22-m00+1)
  89. local recip = 0.5/s
  90. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  91. elseif i == 2 then
  92. local s = math.sqrt(m22-m00-m11+1)
  93. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  94. end
  95. end
  96. end
  97. local function QuaternionToCFrame(px, py, pz, x, y, z, w)
  98. local xs, ys, zs = x + x, y + y, z + z
  99. local wx, wy, wz = w*xs, w*ys, w*zs
  100. local xx = x*xs
  101. local xy = x*ys
  102. local xz = x*zs
  103. local yy = y*ys
  104. local yz = y*zs
  105. local zz = z*zs
  106. return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
  107. end
  108. local function QuaternionSlerp(a, b, t)
  109. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  110. local startInterp, finishInterp;
  111. if cosTheta >= 0.0001 then
  112. if (1 - cosTheta) > 0.0001 then
  113. local theta = math.acos(cosTheta)
  114. local invSinTheta = 1/math.sin(theta)
  115. startInterp = math.sin((1-t)*theta)*invSinTheta
  116. finishInterp = math.sin(t*theta)*invSinTheta
  117. else
  118. startInterp = 1-t
  119. finishInterp = t
  120. end
  121. else
  122. if (1+cosTheta) > 0.0001 then
  123. local theta = math.acos(-cosTheta)
  124. local invSinTheta = 1/math.sin(theta)
  125. startInterp = math.sin((t-1)*theta)*invSinTheta
  126. finishInterp = math.sin(t*theta)*invSinTheta
  127. else
  128. startInterp = t-1
  129. finishInterp = t
  130. end
  131. end
  132. return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
  133. end
  134. function clerp(a,b,t)
  135. local qa = {QuaternionFromCFrame(a)}
  136. local qb = {QuaternionFromCFrame(b)}
  137. local ax, ay, az = a.x, a.y, a.z
  138. local bx, by, bz = b.x, b.y, b.z
  139. local _t = 1-t
  140. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  141. end
  142. end
  143.  
  144. function lerp(a,b,c)
  145. return a+(b-a)*c
  146. end
  147.  
  148. function ctlerp(c1,c2,al) -- Older, "worse" clerp if the other one fails..
  149. local com1 = {c1:components()}
  150. local com2 = {c2:components()}
  151. for i,v in pairs(com1) do
  152. com1[i] = lerp(v,com2[i],al)
  153. end
  154. return CFrame.new(unpack(com1))
  155. end
  156.  
  157.  
  158. local Model = Instance.new("Model",ModelParent)
  159. Model.Name = ModelName
  160.  
  161. local BasePart = Instance.new("Part")
  162. BasePart.FormFactor = "Custom"
  163. BasePart.Size = Vector3.new()
  164. BasePart.TopSurface,BasePart.BottomSurface,BasePart.LeftSurface,BasePart.RightSurface,BasePart.FrontSurface,BasePart.BackSurface = 10,10,10,10,10,10
  165. BasePart:BreakJoints()
  166. BasePart.CFrame = startpos
  167.  
  168. function NP()
  169. local p = BasePart:Clone()
  170. p.Parent = Model
  171. return p
  172. end
  173.  
  174. function Sphere(parent,scale)
  175. local sm = Instance.new("SpecialMesh",parent)
  176. sm.MeshType = "Sphere"
  177. sm.Scale = scale or Vector3.new(1,1,1)
  178. return sm
  179. end
  180.  
  181. BasePart.BrickColor = HorseColor
  182.  
  183. local Main = NP()
  184. Main.Size = Vector3.new(3.5,4.5,8)
  185. Main.CFrame = startpos
  186.  
  187. MainMesh = Sphere(Main)
  188.  
  189. local Neck = NP()
  190. Neck.Size = Vector3.new(2,5,2.5)
  191. local NeckWeld = Weld(Main,Neck,CFrame.new(0,0.5,-3.2)*CFrame.Angles(math.rad(-20),0,0),CFrame.new(0,-1.5,0))
  192. local NeckWeld0 = NeckWeld.C0
  193. Sphere(Neck,Vector3.new(1,1,1))
  194.  
  195. local NeckBonus = NP()
  196. NeckBonus.Size = Vector3.new(1.9,3,2)
  197. Weld(Neck,NeckBonus,CFrame.new(0,-1.1,.5)*CFrame.Angles(-.5,0,0))
  198. Sphere(NeckBonus)
  199.  
  200. local Head = NP()
  201. Head.Size = Vector3.new(2,3,3)
  202. local HeadWeld = Weld(Neck,Head,CFrame.new(0,2.5,-.4),CFrame.new(0,0,1))
  203. local HeadWeld0 = HeadWeld.C0
  204. local HeadMesh = Instance.new("SpecialMesh",Head)
  205. HeadMesh.Scale = Vector3.new(0.7,1,1)*1.6
  206. HeadMesh.MeshId = "http://www.roblox.com/asset/?id=114690930"
  207.  
  208. if HasHat then
  209. local Hat = NP()
  210. Hat.Size = Vector3.new()
  211. Hat.BrickColor = SaddleColor
  212. local HatWeld = Weld(Head,Hat,CFrame.new(0,1.11,1.3),CFrame.Angles(math.rad(-20),0,0))
  213. local HatMesh = Instance.new("SpecialMesh",Hat)
  214. HatMesh.Scale = Vector3.new(1.5,1.5,1.5)
  215. HatMesh.MeshId = HatMeshId or "rbxassetid://42157240"
  216. HatMesh.TextureId = HatTexId or ""
  217. end
  218.  
  219. local EyeR = NP()
  220. EyeR.BrickColor = EyeColor
  221. EyeR.Reflectance = .1
  222. EyeR.Size = Vector3.new(.2,.2,.2)
  223. Weld(Head,EyeR,CFrame.new(.631,.23,.11)*CFrame.Angles(-0.2,0.1,0))
  224. Sphere(EyeR,Vector3.new(.9,2.1,2.1))
  225.  
  226. local EyeL = NP()
  227. EyeL.BrickColor = EyeColor
  228. EyeL.Reflectance = .1
  229. EyeL.Size = Vector3.new(.2,.2,.2)
  230. Weld(Head,EyeL,CFrame.new(-.631,.23,.11)*CFrame.Angles(-0.2,-0.1,0))
  231. Sphere(EyeL,Vector3.new(.9,2.1,2.1))
  232.  
  233. BasePart.Name = "Reins"
  234.  
  235. local RPart = NP() -- rs1
  236. RPart.BrickColor = ReinsColor
  237. RPart.Size = Vector3.new(.2,.7,.25)
  238. Weld(Head,RPart,CFrame.new(.4,-.5,-1.05)*CFrame.Angles(-.25,0,0))
  239.  
  240. local Cyl = NP()
  241. Cyl.BrickColor = ReinsColor
  242. Cyl.Size = Vector3.new(.2495,.2,.2)
  243. Instance.new("SpecialMesh",Cyl).MeshType = "Cylinder"
  244. Weld(RPart,Cyl,CFrame.new(0,RPart.Size.Y/2,0)*CFrame.Angles(0,math.pi/2,0))
  245.  
  246. local RPart = NP() -- rs2
  247. RPart.BrickColor = ReinsColor
  248. RPart.Size = Vector3.new(.2,.4,.25)
  249. Weld(Head,RPart,CFrame.new(.4,-.5,-1.05)*CFrame.Angles(-.25,0,0)*CFrame.new(0,-.35,0)*CFrame.Angles(0,0,-.5)*CFrame.new(0,-.2,0))
  250.  
  251. local Cyl = NP()
  252. Cyl.BrickColor = ReinsColor
  253. Cyl.Size = Vector3.new(.2495,.2,.2)
  254. Instance.new("SpecialMesh",Cyl).MeshType = "Cylinder"
  255. Weld(RPart,Cyl,CFrame.new(0,RPart.Size.Y/2,0)*CFrame.Angles(0,math.pi/2,0))
  256. local ReinAnchorR = Cyl
  257.  
  258. local RPart = NP() -- ls1
  259. RPart.BrickColor = ReinsColor
  260. RPart.Size = Vector3.new(.2,.7,.25)
  261. Weld(Head,RPart,CFrame.new(-.4,-.5,-1.05)*CFrame.Angles(-.25,0,0))
  262.  
  263. local Cyl = NP()
  264. Cyl.BrickColor = ReinsColor
  265. Cyl.Size = Vector3.new(.2495,.2,.2)
  266. Instance.new("SpecialMesh",Cyl).MeshType = "Cylinder"
  267. Weld(RPart,Cyl,CFrame.new(0,RPart.Size.Y/2,0)*CFrame.Angles(0,math.pi/2,0))
  268.  
  269. local RPart = NP() -- ls2
  270. RPart.BrickColor = ReinsColor
  271. RPart.Size = Vector3.new(.2,.4,.25)
  272. Weld(Head,RPart,CFrame.new(-.4,-.5,-1.05)*CFrame.Angles(-.25,0,0)*CFrame.new(0,-.35,0)*CFrame.Angles(0,0,.5)*CFrame.new(0,-.2,0))
  273.  
  274. local Cyl = NP()
  275. Cyl.BrickColor = ReinsColor
  276. Cyl.Size = Vector3.new(.2495,.2,.2)
  277. Instance.new("SpecialMesh",Cyl).MeshType = "Cylinder"
  278. Weld(RPart,Cyl,CFrame.new(0,RPart.Size.Y/2,0)*CFrame.Angles(0,math.pi/2,0))
  279. local ReinAnchorL = Cyl
  280.  
  281. local RPart = NP() -- mb
  282. RPart.BrickColor = ReinsColor
  283. RPart.Size = Vector3.new(.5,.2,.249)
  284. Weld(Head,RPart,CFrame.new(0,-.5,-1.05)*CFrame.Angles(-.25,0,0)*CFrame.new(0,-.65,0))
  285.  
  286. local Cyl = NP()
  287. Cyl.BrickColor = ReinsColor
  288. Cyl.Size = Vector3.new(.2495,.2,.2)
  289. Instance.new("SpecialMesh",Cyl).MeshType = "Cylinder"
  290. Weld(RPart,Cyl,CFrame.new(RPart.Size.X/2,0,0)*CFrame.Angles(0,math.pi/2,0))
  291.  
  292. local Cyl = NP()
  293. Cyl.BrickColor = ReinsColor
  294. Cyl.Size = Vector3.new(.2495,.2,.2)
  295. Instance.new("SpecialMesh",Cyl).MeshType = "Cylinder"
  296. Weld(RPart,Cyl,CFrame.new(-RPart.Size.X/2,0,0)*CFrame.Angles(0,math.pi/2,0))
  297.  
  298. local RPart = NP() -- mt
  299. RPart.BrickColor = ReinsColor
  300. RPart.Size = Vector3.new(.8,.2,.249)
  301. Weld(Head,RPart,CFrame.new(0,-.5,-1.05)*CFrame.Angles(-.25,0,0)*CFrame.new(0,.35,0))
  302.  
  303. local RPart = NP()
  304. RPart.BrickColor = ReinsColor
  305. local sm = Instance.new("SpecialMesh",RPart)
  306. sm.MeshType = "Sphere"
  307. local ReinSphereL = Weld(Main,RPart,CFrame.new(-1,3,0))
  308.  
  309. local RPart = NP()
  310. RPart.BrickColor = ReinsColor
  311. local sm = Instance.new("SpecialMesh",RPart)
  312. sm.MeshType = "Cylinder"
  313. local ReinLineL = Weld(Main,RPart,CFrame.new(-1,3,-1))
  314.  
  315. local RPart = NP()
  316. RPart.BrickColor = ReinsColor
  317. local sm = Instance.new("SpecialMesh",RPart)
  318. sm.MeshType = "Sphere"
  319. local ReinSphereR = Weld(Main,RPart,CFrame.new(1,3,0))
  320.  
  321. local RPart = NP()
  322. RPart.BrickColor = ReinsColor
  323. local sm = Instance.new("SpecialMesh",RPart)
  324. sm.MeshType = "Cylinder"
  325. local ReinLineR = Weld(Main,RPart,CFrame.new(1,3,-1))
  326.  
  327. local RPart = NP()
  328. RPart.BrickColor = ReinsColor
  329. local sm = Instance.new("SpecialMesh",RPart)
  330. sm.MeshType = "Cylinder"
  331. local ReinLineM = Weld(Main,RPart,CFrame.new(0,3,0))
  332.  
  333. BasePart.Name = "Part"
  334.  
  335. local Tail = NP()
  336. Tail.BrickColor = ManeColor
  337. Tail.CanCollide = false
  338. Tail.Transparency = 1
  339. Tail.Size = Vector3.new(0.8,4.5,0.8)
  340. local TailWeld = Weld(Main,Tail,CFrame.new(0,.88,3.4)*CFrame.Angles(0,math.rad(10),0),CFrame.new(0,-2.3,0)*CFrame.Angles(math.rad(-130),0,0))
  341. local TailWeld0 = TailWeld.C0
  342. local TailHairs = {}
  343. for i=1,8 do
  344. local t = NP()
  345. t.CanCollide = false
  346. t.BrickColor = Tail.BrickColor
  347. t.Size = Vector3.new(.4+aran()*.2,5.5-i*.1,.4+aran()*.2)
  348. local tw = Weld(Tail,t,CFrame.new(0,-Tail.Size.Y/2,0)*CFrame.Angles(ran()*.15,ran()*.5,ran()*.15)*CFrame.new(ran()*.1,0,ran()*.1),CFrame.new(0,-t.Size.Y/2+.05,0))
  349. table.insert(TailHairs,{w=tw,c0=tw.C0})
  350. end
  351. local BackHairs = {}
  352. for i=0,10 do
  353. if i<1 or i>7 then
  354. local x = (i/10)
  355. local m = NP()
  356. m.CanCollide = false
  357. m.BrickColor = ManeColor
  358. m.Size = Vector3.new(.6+aran()*.2+math.sin(x*2.7)*.5,.9+ran()*.1,.9+ran()*.1)
  359. if i<1 then m.Size = m.Size*0.7 end
  360. local tw = Weld(Main,m,CFrame.new(0,.9+math.sin(x*2.8)*1.2,3.4-x*6),CFrame.Angles(ran()*.1,aran()*.1,ran()*.2))
  361. table.insert(BackHairs,{w=tw,c0=tw.C0})
  362. end
  363. end
  364.  
  365.  
  366. local NeckHairs = {}
  367. for i=0,6 do
  368. local x = (i/6)
  369. local m = NP()
  370. m.CanCollide = false
  371. m.BrickColor = ManeColor
  372. m.Size = Vector3.new(.8+ran()*.2,.7+ran()*.1,.9+ran()*.1)
  373. local tw = Weld(Neck,m,CFrame.new(0,-1.3+x*3.5,1+math.sin(.55+x*3.7)*.5),CFrame.Angles(ran()*.08,aran()*.15,ran()*.08))
  374. table.insert(NeckHairs ,{w=tw,c0=tw.C0})
  375. end
  376.  
  377.  
  378. local HeadHairs = {}
  379. for i=0,6 do
  380. local x = math.min(1,(i/3))
  381. local m = NP()
  382. m.CanCollide = false
  383. m.BrickColor = ManeColor
  384. if HasHat then m.Transparency = 1 end
  385. m.Size = Vector3.new(.95+ran()*.2,1,.4)
  386. local tw = Weld(Head,m,CFrame.new(0,-.8+x*1.6,2.02-i*.23)*CFrame.Angles(-.2-i*.3,0,0),CFrame.Angles(ran()*.08,aran()*.03,ran()*.08))
  387. table.insert(HeadHairs ,{w=tw,c0=tw.C0})
  388. end
  389.  
  390. local LHip = NP()
  391. LHip.Size = Vector3.new(1.5,3.7,3.5)
  392. Weld(Main,LHip,CFrame.new(-1,-.5,2.2)*CFrame.Angles(0,.35,0))
  393. Sphere(LHip)
  394.  
  395. local LThigh = NP()
  396. LThigh.CanCollide = false
  397. LThigh.Size = Vector3.new(1.6,4,2.2)
  398. local BL1 = Weld(LHip,LThigh,CFrame.new(-.05,.3,-.5)*CFrame.Angles(0,-.35,0)*CFrame.Angles(0,0,0),CFrame.new(0,1.7,0))
  399. Sphere(LThigh)
  400.  
  401. local LBCannon = NP()
  402. LBCannon.CanCollide = false
  403. LBCannon.Size = Vector3.new(1,2.8,1)
  404. local sm = Instance.new("SpecialMesh",LBCannon)
  405. sm.MeshType = "Head"
  406. local BL2 = Weld(LThigh,LBCannon,CFrame.new(0,-LThigh.Size.Y/2+.4,-.05)*CFrame.Angles(0,0,0),CFrame.new(0,1.3,0))
  407.  
  408. local LBKnee = NP()
  409. LBKnee.CanCollide = false
  410. LBKnee.Size = Vector3.new(1,1,1)
  411. local sm = Instance.new("SpecialMesh",LBKnee)
  412. sm.MeshType = "Sphere"
  413. Weld(LBCannon,LBKnee,CFrame.new(0,LBCannon.Size.Y/2-.1,0))
  414.  
  415. local LBHoof = NP()
  416. LBHoof.BrickColor = HoofColor
  417. LBHoof.CanCollide = false
  418. LBHoof.Size = Vector3.new(1,.7,1)
  419. Instance.new("CylinderMesh",LBHoof)
  420. local BL3 = Weld(LBCannon,LBHoof,CFrame.new(0,-LBCannon.Size.Y/2,0)*CFrame.Angles(0,0,0),CFrame.new(0,.12,.2))
  421.  
  422. local Hoof = NP()
  423. Hoof.BrickColor = HoofColor
  424. Hoof.CanCollide = false
  425. Hoof.Size = Vector3.new(.2,.699,.5)
  426. Weld(LBHoof,Hoof,CFrame.new(.4,0,.25))
  427. local Hoof = NP()
  428. Hoof.BrickColor = HoofColor
  429. Hoof.CanCollide = false
  430. Hoof.Size = Vector3.new(.2,.699,.5)
  431. Weld(LBHoof,Hoof,CFrame.new(-.4,0,.25))
  432.  
  433. local RHip = NP()
  434. RHip.Size = Vector3.new(1.5,3.7,3.5)
  435. Weld(Main,RHip,CFrame.new(1,-.5,2.2)*CFrame.Angles(0,-.35,0))
  436. Sphere(RHip)
  437.  
  438. local RThigh = NP()
  439. RThigh.CanCollide = false
  440. RThigh.Size = Vector3.new(1.6,4,2.2)
  441. local BR1 = Weld(RHip,RThigh,CFrame.new(.05,.3,-.4)*CFrame.Angles(0,.35,0)*CFrame.Angles(0,0,0),CFrame.new(0,1.7,0))
  442. Sphere(RThigh)
  443.  
  444. local RBCannon = NP()
  445. RBCannon.CanCollide = false
  446. RBCannon.Size = Vector3.new(1,2.8,1)
  447. local sm = Instance.new("SpecialMesh",RBCannon)
  448. sm.MeshType = "Head"
  449. local BR2 = Weld(RThigh,RBCannon,CFrame.new(0,-RThigh.Size.Y/2+.4,-.05)*CFrame.Angles(0,0,0),CFrame.new(0,1.3,0))
  450.  
  451. local RBKnee = NP()
  452. RBKnee.CanCollide = false
  453. RBKnee.Size = Vector3.new(1,1,1)
  454. local sm = Instance.new("SpecialMesh",RBKnee)
  455. sm.MeshType = "Sphere"
  456. Weld(RBCannon,RBKnee,CFrame.new(0,RBCannon.Size.Y/2-.1,0))
  457.  
  458. local RBHoof = NP()
  459. RBHoof.BrickColor = HoofColor
  460. RBHoof.CanCollide = false
  461. RBHoof.Size = Vector3.new(1,.7,1)
  462. Instance.new("CylinderMesh",RBHoof)
  463. local BR3 = Weld(RBCannon,RBHoof,CFrame.new(0,-RBCannon.Size.Y/2,0)*CFrame.Angles(0,0,0),CFrame.new(0,.12,.2))
  464.  
  465. local Hoof = NP()
  466. Hoof.BrickColor = HoofColor
  467. Hoof.CanCollide = false
  468. Hoof.Size = Vector3.new(.2,.699,.5)
  469. Weld(RBHoof,Hoof,CFrame.new(.4,0,.25))
  470. local Hoof = NP()
  471. Hoof.BrickColor = HoofColor
  472. Hoof.CanCollide = false
  473. Hoof.Size = Vector3.new(.2,.699,.5)
  474. Weld(RBHoof,Hoof,CFrame.new(-.4,0,.25))
  475.  
  476. local LShoulder = NP()
  477. LShoulder.Size = Vector3.new(1.5,2.5,2)
  478. Weld(Main,LShoulder,CFrame.new(-.9,-.5,-2.4)*CFrame.Angles(0,.15,0))
  479. Sphere(LShoulder)
  480.  
  481. local LForearm = NP()
  482. LForearm.CanCollide = false
  483. LForearm.Size = Vector3.new(1.2,3.5,1.5)
  484. local FL1 = Weld(LShoulder,LForearm,CFrame.new(-.1,.2,.1)*CFrame.Angles(0,0,0),CFrame.new(0,1.45,0))
  485. Sphere(LForearm)
  486.  
  487. local LFCannon = NP()
  488. LFCannon.CanCollide = false
  489. LFCannon.Size = Vector3.new(.8,2.8,.8)
  490. local sm = Instance.new("SpecialMesh",LFCannon)
  491. sm.MeshType = "Head"
  492. local FL2 = Weld(LForearm,LFCannon,CFrame.new(0,-LForearm.Size.Y/2+.4,-.05)*CFrame.Angles(0,0,0),CFrame.new(0,1.3,0))
  493.  
  494. local LFKnee= NP()
  495. LFKnee.CanCollide = false
  496. LFKnee.Size = Vector3.new(.8,.8,.8)
  497. local sm = Instance.new("SpecialMesh",LFKnee)
  498. sm.MeshType = "Sphere"
  499. Weld(LFCannon,LFKnee,CFrame.new(0,LFCannon.Size.Y/2-.1,0))
  500.  
  501. local LFHoof = NP()
  502. LFHoof.BrickColor = HoofColor
  503. LFHoof.CanCollide = false
  504. LFHoof.Size = Vector3.new(.8,.6,.8)
  505. Instance.new("CylinderMesh",LFHoof)
  506. local FL3 = Weld(LFCannon,LFHoof,CFrame.new(0,-LFCannon.Size.Y/2,0)*CFrame.Angles(0,0,0),CFrame.new(0,.12,.2))
  507.  
  508. local Hoof = NP()
  509. Hoof.BrickColor = HoofColor
  510. Hoof.CanCollide = false
  511. Hoof.Size = Vector3.new(.2,.599,.4)
  512. Weld(LFHoof,Hoof,CFrame.new(.3,0,.2))
  513. local Hoof = NP()
  514. Hoof.BrickColor = HoofColor
  515. Hoof.CanCollide = false
  516. Hoof.Size = Vector3.new(.2,.599,.4)
  517. Weld(LFHoof,Hoof,CFrame.new(-.3,0,.2))
  518.  
  519. local RShoulder = NP()
  520. RShoulder.Size = Vector3.new(1.5,2.5,2)
  521. Weld(Main,RShoulder,CFrame.new(.9,-.5,-2.4)*CFrame.Angles(0,-.15,0))
  522. Sphere(RShoulder)
  523.  
  524. local RForearm = NP()
  525. RForearm.CanCollide = false
  526. RForearm.Size = Vector3.new(1.2,3.5,1.5)
  527. local FR1 = Weld(RShoulder,RForearm,CFrame.new(.1,.2,-.1)*CFrame.Angles(0,0,0),CFrame.new(0,1.45,0))
  528. Sphere(RForearm)
  529.  
  530. local RFCannon = NP()
  531. RFCannon.CanCollide = false
  532. RFCannon.Size = Vector3.new(.8,2.8,.8)
  533. local sm = Instance.new("SpecialMesh",RFCannon)
  534. sm.MeshType = "Head"
  535. local FR2 = Weld(RForearm,RFCannon,CFrame.new(0,-RForearm.Size.Y/2+.4,-.05)*CFrame.Angles(0,0,0),CFrame.new(0,1.3,0))
  536.  
  537. local RFKnee= NP()
  538. RFKnee.CanCollide = false
  539. RFKnee.Size = Vector3.new(.8,.8,.8)
  540. local sm = Instance.new("SpecialMesh",RFKnee)
  541. sm.MeshType = "Sphere"
  542. Weld(RFCannon,RFKnee,CFrame.new(0,RFCannon.Size.Y/2-.1,0))
  543.  
  544. local RFHoof = NP()
  545. RFHoof.BrickColor = HoofColor
  546. RFHoof.CanCollide = false
  547. RFHoof.Size = Vector3.new(.8,.6,.8)
  548. Instance.new("CylinderMesh",RFHoof)
  549. local FR3 = Weld(RFCannon,RFHoof,CFrame.new(0,-RFCannon.Size.Y/2,0)*CFrame.Angles(0,0,0),CFrame.new(0,.12,.2))
  550.  
  551. local Hoof = NP()
  552. Hoof.BrickColor = HoofColor
  553. Hoof.CanCollide = false
  554. Hoof.Size = Vector3.new(.2,.599,.4)
  555. Weld(RFHoof,Hoof,CFrame.new(.3,0,.2))
  556. local Hoof = NP()
  557. Hoof.BrickColor = HoofColor
  558. Hoof.CanCollide = false
  559. Hoof.Size = Vector3.new(.2,.599,.4)
  560. Weld(RFHoof,Hoof,CFrame.new(-.3,0,.2))
  561.  
  562.  
  563.  
  564. Seat = Instance.new("VehicleSeat",Model)
  565. Seat.TopSurface,Seat.BottomSurface,Seat.LeftSurface,Seat.RightSurface,Seat.FrontSurface,Seat.BackSurface = 10,10,10,10,10,10
  566. Seat.Size = Vector3.new(2,1.2,.5)
  567. Seat.HeadsUpDisplay = false
  568. Seat.CanCollide = false
  569. Seat:BreakJoints()
  570. Seat.Transparency = 1
  571. Seat.CFrame = Main.CFrame
  572. SeatWeld = Weld(Main,Seat,CFrame.new(0,2.5,-.5),CFrame.new(0,0,0))
  573. local SeatWeld0 = SeatWeld.C0
  574.  
  575. Seat2 = Instance.new("Seat",Model)
  576. Seat2.TopSurface,Seat2.BottomSurface,Seat2.LeftSurface,Seat2.RightSurface,Seat2.FrontSurface,Seat2.BackSurface = 10,10,10,10,10,10
  577. Seat2.Size = Vector3.new(2,1.2,.5)
  578. Seat2.CanCollide = false
  579. Seat2.CFrame = Main.CFrame
  580. Seat2:BreakJoints()
  581. Seat2.Transparency = 1
  582. Weld(Seat2,Seat,CFrame.new(0,0,-1.8))
  583.  
  584. SaddleMain = NP()
  585. SaddleMain.Size = Vector3.new(2,1,3.5)
  586. SaddleMain.BrickColor = SaddleColor
  587. Sphere(SaddleMain)
  588. Weld(Seat,SaddleMain,CFrame.new(0,-0.5,0.6))
  589.  
  590. SaddleFront = NP()
  591. SaddleFront.Size = Vector3.new(1.6,1,0.3)
  592. SaddleFront.BrickColor = SaddleColor
  593. Sphere(SaddleFront)
  594. Weld(SaddleMain,SaddleFront,CFrame.new(0,0.4,-1.4)*CFrame.Angles(math.rad(-30),0,0))
  595.  
  596. SaddleBack = NP()
  597. SaddleBack.Size = Vector3.new(1.6,1,0.5)
  598. SaddleBack.BrickColor = SaddleColor
  599. Sphere(SaddleBack)
  600. Weld(SaddleMain,SaddleBack,CFrame.new(0,0.3,1.4)*CFrame.Angles(math.rad(30),0,0))
  601.  
  602. SaddleFlankR = NP()
  603. SaddleFlankR.Size = Vector3.new(0.3,1.7,1.8)
  604. SaddleFlankR.BrickColor = SaddleColor
  605. Sphere(SaddleFlankR)
  606. Weld(SaddleMain,SaddleFlankR,CFrame.new(1.5,-0.8,0),CFrame.new(0.1,-0.7,0)*CFrame.Angles(0,0,math.rad(-30)))
  607.  
  608. SaddleFlankL = NP()
  609. SaddleFlankL.Size = Vector3.new(0.3,1.7,1.8)
  610. SaddleFlankL.BrickColor = SaddleColor
  611. Sphere(SaddleFlankL)
  612. Weld(SaddleMain,SaddleFlankL,CFrame.new(-1.5,-0.8,0),CFrame.new(-0.1,-0.7,0)*CFrame.Angles(0,0,math.rad(30)))
  613.  
  614.  
  615.  
  616. local sWeld1,sWeld2;
  617.  
  618. Seat.DescendantAdded:connect(function(obj)
  619. if obj.Name == "SeatWeld" then
  620. sWeld1 = obj
  621. torso2 = obj.Part1.Parent.Torso
  622. local Torso = obj.Part1.Parent.Torso
  623. obj.C0 = obj.C0*CFrame.new(0,0,-1.5)
  624. local lhipr = Torso:FindFirstChild("Left Hip")
  625. local rhipr = Torso:FindFirstChild("Right Hip")
  626. if not lhipr or not rhipr then game:service'Debris':addItem(obj,.1) return end
  627. for i,v in pairs(Model:GetChildren()) do
  628. if v.Name == "Reins" and v:IsA("BasePart") then
  629. v.Transparency = Main.Transparency
  630. end
  631. end
  632. local lh0,lh1 = lhipr.Part0,lhipr.Part1
  633. local rh0,rh1 = rhipr.Part0,rhipr.Part1
  634. lhipr.Part0,lhipr.Part1 = nil,nil
  635. rhipr.Part0,rhipr.Part1 = nil,nil
  636. local lhip = lhipr:Clone()
  637. lhip.Name = "LH"
  638. lhip.Parent = lhipr.Parent
  639. lhip.Part0,lhip.Part1 = lh0,lh1
  640. local rhip = rhipr:Clone()
  641. rhip.Name = "RH"
  642. rhip.Parent = rhipr.Parent
  643. rhip.Part0,rhip.Part1 = rh0,rh1
  644. lhip.DesiredAngle = 0
  645. rhip.DesiredAngle = 0
  646. local lhip0,lhip1,rhip0,rhip1 = lhip.C0,lhip.C1,rhip.C0,rhip.C1
  647. lhip.C0 = lhip0*CFrame.new(0,0.5,0)*CFrame.Angles(math.rad(-45),0,math.rad(-40))
  648. lhip.C1 = lhip1*CFrame.new(0.1,-0.2,0)
  649. rhip.C0 = rhip0*CFrame.new(0,0.5,0)*CFrame.Angles(math.rad(-45),0,math.rad(40))
  650. rhip.C1 = rhip1*CFrame.new(-0.1,-0.2,0)
  651. local toolOn = false
  652. local toolAn = 0
  653. local toolCon;
  654. local toolChan;
  655. local oc0 = obj.C0
  656. local newChild = function(d)
  657. local md = d:FindFirstChild("MouseDown")
  658. if d:IsA("Tool") and md and md:IsA("BoolValue") then
  659. pcall(function() toolChan:disconnect() end)
  660. toolOn = false
  661. toolChan = md.Changed:connect(function()
  662. toolOn = md.Value
  663. if not toolOn then return end
  664. pcall(function() ReinsHold = CFrame.new(0,2,-1.7) end)
  665. while toolOn and game:service'RunService'.Stepped:wait() do
  666. toolAn = math.min(1,toolAn+.2)
  667. obj.C0 = CFrame.new(toolAn*1.8,toolAn*-1.1,0)*CFrame.Angles(0,0,-toolAn*.9)*oc0
  668. end
  669. while not toolOn and game:service'RunService'.Stepped:wait() do
  670. toolAn = math.max(0,toolAn-.2)
  671. obj.C0 = CFrame.new(toolAn*1.8,toolAn*-1.1,0)*CFrame.Angles(0,0,-toolAn*.9)*oc0
  672. if toolAn == 0 then break end
  673. end
  674. ReinsHold = nil
  675. end)
  676. end
  677. end
  678. local ctrlgui;
  679. if Torso.Parent then
  680. toolCon = Torso.Parent.ChildAdded:connect(newChild)
  681. for i,v in pairs(Torso.Parent:GetChildren()) do
  682. newChild(v)
  683. end
  684. local plr = game.Players:GetPlayerFromCharacter(Torso.Parent)
  685. if plr then
  686. ctrlgui = Instance.new("ScreenGui")
  687. local fr = Instance.new("Frame",ctrlgui)
  688. fr.Position = UDim2.new(1,0,.9,0)
  689. fr.Size = UDim2.new(-.07,0,.02,0)
  690. fr.BackgroundTransparency = 1
  691. local function nbtn(text,indent)
  692. for i,v in pairs(fr:GetChildren()) do
  693. v.Position = v.Position - UDim2.new(0,0,1,1)
  694. end
  695. local tb = Instance.new("TextButton",fr)
  696. tb.Size = UDim2.new(-1,4+(indent-1)*3,1,-4)
  697. tb.Position = UDim2.new(1,2,0,2)
  698. tb.BorderSizePixel = 3
  699. tb.BackgroundColor3 = HorseColor.Color
  700. tb.BorderColor3 = ManeColor.Color
  701. tb.Text = " "..text.." "
  702. tb.TextXAlignment = "Left"
  703. tb.TextColor3 = Color3.new(1,1,1)
  704. tb.TextStrokeTransparency = .6
  705. tb.TextScaled = true
  706. tb.ZIndex = 10
  707. local il = Instance.new("ImageLabel",tb)
  708. il.Size = UDim2.new(-1,2,1,-2)
  709. il.Image = "rbxassetid://129465985"
  710. il.SizeConstraint = "RelativeYY"
  711. il.BackgroundTransparency = 1
  712. il.Position = UDim2.new(1,0,0,2)
  713. il.ZIndex = 10
  714. return tb
  715. end
  716. nbtn("| Horse menu",1).AutoButtonColor = false
  717. nbtn("- Max speed",2).AutoButtonColor = false
  718. local gal = nbtn("~ Gallop",3)
  719. local trot = nbtn("~ Trot",3)
  720. local walk = nbtn("~ Walk",3)
  721. local tar = (SpeedLimit == MaxSpeed and gal or SpeedLimit == TrotSpeed and trot or walk)
  722. tar.BackgroundColor3 = Color3.new(0,.7,0)
  723. gal.MouseButton1Down:connect(function()
  724. gal.BackgroundColor3 = Color3.new(0,.7,0)
  725. trot.BackgroundColor3 = HorseColor.Color
  726. walk.BackgroundColor3 = HorseColor.Color
  727. SpeedLimit = MaxSpeed
  728. end)
  729. trot.MouseButton1Down:connect(function()
  730. gal.BackgroundColor3 = HorseColor.Color
  731. trot.BackgroundColor3 = Color3.new(0,.7,0)
  732. walk.BackgroundColor3 = HorseColor.Color
  733. SpeedLimit = TrotSpeed
  734. end)
  735. walk.MouseButton1Down:connect(function()
  736. gal.BackgroundColor3 = HorseColor.Color
  737. trot.BackgroundColor3 = HorseColor.Color
  738. walk.BackgroundColor3 = Color3.new(0,.7,0)
  739. SpeedLimit = WalkSpeed
  740. end)
  741. pcall(function()
  742. for i,v in pairs(plr:GetChildren()) do
  743. pcall(function()
  744. if v:IsA("PlayerGui") then
  745. ctrlgui.Parent = v
  746. end
  747. end)
  748. end
  749. end)
  750. end
  751. end
  752.  
  753. obj.AncestryChanged:connect(function(c,p)
  754. if c ~= obj or p == Seat then return end
  755. lhip:Destroy()
  756. rhip:Destroy()
  757. lhipr.Part0,lhipr.Part1 = lh0,lh1
  758. rhipr.Part0,rhipr.Part1 = rh0,rh1
  759. obj:Destroy()
  760. ReinsHold = nil
  761. for i,v in pairs(Model:GetChildren()) do
  762. if v.Name == "Reins" and v:IsA("BasePart") then
  763. v.Transparency = 1
  764. end
  765. end
  766. pcall(function() toolCon:disconnect() end)
  767. pcall(function() toolChan:disconnect() end)
  768. pcall(game.Destroy,ctrlgui)
  769. end)
  770. end
  771. end)
  772.  
  773. Seat2.DescendantAdded:connect(function(obj)
  774. if obj.Name == "SeatWeld" then
  775. sWeld2 = obj
  776. local Torso = obj.Part1.Parent.Torso
  777. obj.C0 = obj.C0*CFrame.new(0,.5,-1.5)
  778. local lhipr = Torso:FindFirstChild("Left Hip")
  779. local rhipr = Torso:FindFirstChild("Right Hip")
  780. if not lhipr or not rhipr then game:service'Debris':addItem(obj,.1) return end
  781. local lh0,lh1 = lhipr.Part0,lhipr.Part1
  782. local rh0,rh1 = rhipr.Part0,rhipr.Part1
  783. lhipr.Part0,lhipr.Part1 = nil,nil
  784. rhipr.Part0,rhipr.Part1 = nil,nil
  785. local lhip = lhipr:Clone()
  786. lhip.Name = "LH"
  787. lhip.Parent = lhipr.Parent
  788. lhip.Part0,lhip.Part1 = lh0,lh1
  789. local rhip = rhipr:Clone()
  790. rhip.Name = "RH"
  791. rhip.Parent = rhipr.Parent
  792. rhip.Part0,rhip.Part1 = rh0,rh1
  793. lhip.DesiredAngle = 0
  794. rhip.DesiredAngle = 0
  795. local lhip0,lhip1,rhip0,rhip1 = lhip.C0,lhip.C1,rhip.C0,rhip.C1
  796. lhip.C0 = lhip0*CFrame.new(0,0.5,0)*CFrame.Angles(math.rad(-45),0,math.rad(-40))
  797. lhip.C1 = lhip1*CFrame.new(0.1,-0.2,0)
  798. rhip.C0 = rhip0*CFrame.new(0,0.5,0)*CFrame.Angles(math.rad(-45),0,math.rad(40))
  799. rhip.C1 = rhip1*CFrame.new(-0.1,-0.2,0)
  800. local toolOn = false
  801. local toolAn = 0
  802. local toolCon;
  803. local toolChan;
  804. local oc0 = obj.C0
  805. local newChild = function(d)
  806. local md = d:FindFirstChild("MouseDown")
  807. if d:IsA("Tool") and md and md:IsA("BoolValue") then
  808. pcall(function() toolChan:disconnect() end)
  809. toolOn = false
  810. toolChan = md.Changed:connect(function()
  811. toolOn = md.Value
  812. if not toolOn then return end
  813. while toolOn and game:service'RunService'.Stepped:wait() do
  814. toolAn = math.min(1,toolAn+.2)
  815. obj.C0 = CFrame.new(toolAn*1.8,toolAn*-1.1,0)*CFrame.Angles(0,0,-toolAn*.9)*oc0
  816. end
  817. while not toolOn and game:service'RunService'.Stepped:wait() do
  818. toolAn = math.max(0,toolAn-.2)
  819. obj.C0 = CFrame.new(toolAn*1.8,toolAn*-1.1,0)*CFrame.Angles(0,0,-toolAn*.9)*oc0
  820. if toolAn == 0 then break end
  821. end
  822. end)
  823. end
  824. end
  825. toolCon = Torso.Parent.ChildAdded:connect(newChild)
  826. for i,v in pairs(Torso.Parent:GetChildren()) do
  827. newChild(v)
  828. end
  829. obj.AncestryChanged:connect(function(c,p)
  830. if c ~= obj or p == Seat2 then return end
  831. lhip:Destroy()
  832. rhip:Destroy()
  833. lhipr.Part0,lhipr.Part1 = lh0,lh1
  834. rhipr.Part0,rhipr.Part1 = rh0,rh1
  835. obj:Destroy()
  836. end)
  837. end
  838. end)
  839.  
  840. for i,v in pairs(Model:GetChildren()) do
  841. if v.Name == "Reins" and v:IsA("BasePart") then
  842. v.Transparency = 1
  843. end
  844. end
  845.  
  846. local Filler = NP()
  847. Filler.Size = Vector3.new(3,4,7)
  848. Filler.Transparency = 1
  849. Weld(Main,Filler,CFrame.new(0,-2,0))
  850.  
  851. local BallB = NP()
  852. BallB.CanCollide = true
  853. BallB.Shape = "Ball"
  854. BallB.Size = Vector3.new(3,3,3)
  855. BallB.Transparency = 1
  856. local BBW = Weld(Main,BallB,CFrame.new(0,-Height+BallB.Size.Y/2,3))
  857. BBW0 = BBW.C0
  858.  
  859. local BallF = NP()
  860. BallF.CanCollide = true
  861. BallF.Shape = "Ball"
  862. BallF.Size = Vector3.new(3,3,3)
  863. BallF.Transparency = 1
  864. local FBW = Weld(Main,BallF,CFrame.new(0,-Height+BallB.Size.Y/2,-3))
  865. FBW0 = FBW.C0
  866.  
  867. local BG = Instance.new("BodyGyro",Main)
  868. BG.cframe = Main.CFrame
  869. local bgcf = BG.cframe
  870. BG.maxTorque = Vector3.new(1,1,1)*4e6
  871.  
  872. local BF = Instance.new("BodyForce",Main)
  873. BF.force = Vector3.new(0,10000,0)
  874.  
  875. local BV = Instance.new("BodyVelocity",Main)
  876. BV.maxForce = Vector3.new(1,1,1)*4e6
  877. BV.velocity = Vector3.new()
  878. local bvvel = Vector3.new()
  879.  
  880. local Legs = {
  881. FR1,FR2,FR3,
  882. FL1,FL2,FL3,
  883. BR1,BR2,BR3,
  884. BL1,BL2,BL3,
  885. }
  886. local Legs0 = {}
  887. for i,v in pairs(Legs) do
  888. Legs0[i] = v.C0
  889. end
  890.  
  891. function RayCast(Ray,Ignore)
  892. local hit,p = workspace:FindPartOnRayWithIgnoreList(Ray,Ignore)
  893. if not hit or hit.CanCollide then
  894. return hit,p
  895. elseif hit then
  896. table.insert(Ignore,hit)
  897. return RayCast(Ray,Ignore)
  898. end
  899. end
  900.  
  901.  
  902. --Model:MoveTo(startpos.p)
  903.  
  904. local climbangle = 0
  905. local blinktimer = 0
  906.  
  907. --while game:GetService("RunService").Stepped:wait() do
  908. local connection
  909. connection = game:GetService("RunService").Stepped:connect(oc(function()
  910. if not Model:IsDescendantOf(workspace) then
  911. pcall(game.Destroy,Model)
  912. pcall(game.Destroy,script)
  913. connection:disconnect()
  914. end
  915. local th = Seat.Throttle
  916. local st = Seat.Steer
  917. local TailSin = math.sin(tick()*(th==1 and .5+Speed/MaxSpeed*6 or 2))
  918. local BreathSin = math.sin(tick()*(th==1 and (Speed<=WalkSpeed and WalkSin/2 or Speed<=TrotSpeed and TrotSin/2 or GallopSin/2) or 2))
  919. TailWeld.C0 = clerp(TailWeld.C0,TailWeld0 * CFrame.Angles(math.rad(th == 1 and 20+math.min(1,Speed/MaxSpeed)*(-50+TailSin*10) or th==-1 and 25 or 20),0,TailSin*.3),.15)
  920.  
  921. local d,un = 10;
  922. if th == 0 and st == 0 then
  923. for i,v in pairs(game:GetService("Players"):GetPlayers()) do
  924. pcall(function()
  925. local dis = v:DistanceFromCharacter(Head.Position)
  926. if dis < d then
  927. local u = Main.CFrame:vectorToObjectSpace((v.Character.Head.Position-Head.Position).unit)
  928. if u.Z < 0 then
  929. d,un = dis,u
  930. end
  931. end
  932. end)
  933. end
  934. end
  935.  
  936. if math.random(1,150) == 1 then
  937. blinktimer = 4
  938. end
  939. if blinktimer > 0 then
  940. EyeR.BrickColor = HorseColor
  941. EyeL.BrickColor = HorseColor
  942. blinktimer = blinktimer - 1
  943. else
  944. EyeR.BrickColor = EyeColor
  945. EyeL.BrickColor = EyeColor
  946. end
  947. NeckWeld.C0 = clerp(NeckWeld.C0,CFrame.Angles(0,-st*.1-(un and math.sin(un.X)/2 or 0),-st*.1) *NeckWeld0 * CFrame.Angles(math.rad(BreathSin*2+(th==1 and -math.min(1,math.max(0,Speed-10)/(MaxSpeed-10))*45 or th == -1 and 10 or 0))+(un and math.sin(un.Y)/2 or 0),0,0),.15)
  948. HeadWeld.C0 = clerp(HeadWeld.C0,CFrame.Angles(0,-st*.3-(un and math.sin(un.X)/2 or 0),-st*.1) *HeadWeld0 * CFrame.Angles(math.rad(BreathSin*-4+(th==1 and 10 or th == -1 and -30 or 0))+(un and math.sin(un.Y)/2 or 0),0,0),.15)
  949. MainMesh.Scale = Vector3.new(1,1+(BreathSin*.025),1)
  950. SeatWeld.C0 = SeatWeld0 + Vector3.new(0,BreathSin*.05,0)
  951. bgcf = bgcf * CFrame.Angles(0,-st*.05,0)
  952. BG.cframe = clerp(bgcf,bgcf * CFrame.Angles(0,0,th==1 and -st*(.1+Speed/MaxSpeed*.1) or 0),.1)*CFrame.Angles(climbangle,0,-st*.25*(Speed/MaxSpeed))
  953. Speed = math.max(th==-1 and -WalkSpeed or th==1 and math.min(SpeedLimit,10) or 0,math.min(SpeedLimit,Speed+(th==1 and .25 or -3)))
  954. updown = th==1 and Speed > TrotSpeed and math.abs(math.sin((tick()-.1)*3)) or math.max(0,(updown or 0)-.1)
  955.  
  956. local front = Main.CFrame*CFrame.new(0,0,-3)
  957. local back = Main.CFrame*CFrame.new(0,0,3)
  958.  
  959.  
  960. local fHit,fP = RayCast(Ray.new(front.p,front:vectorToWorldSpace(Vector3.new(0,-Height*6,0))),{Model})
  961.  
  962. local fDiff = (front.p-fP).magnitude
  963. if fDiff > Height*2 then
  964. fHit = nil
  965. end
  966. local fY = math.max(fP.Y,front.Y-Height)
  967.  
  968. local bHit,bP = RayCast(Ray.new(back.p,back:vectorToWorldSpace(Vector3.new(0,-Height*6,0))),{Model})
  969. local bDiff = (back.p-bP).magnitude
  970. if bDiff > Height*2 then
  971. bHit = nil
  972. end
  973. local bY = math.max(bP.Y,back.Y-Height)
  974.  
  975. local diffY = (fY+bY)/2-(Main.Position.Y-Height)
  976.  
  977. climbangle = fHit and bHit and math.asin((fP-bP).unit.Y) or climbangle*.5
  978.  
  979. bvvel = Main.CFrame.lookVector.unit * Speed
  980. BV.velocity = (fP-bP).unit*Speed + Vector3.new(0,-(math.min(fDiff-Height,bDiff-Height)+updown*.8)*3,0)
  981. BV.maxForce = Vector3.new(1,1,1)*4e6
  982. BBW.C0 = BBW0 + Vector3.new(0,updown*.8,-1.4)
  983. FBW.C0 = FBW0 + Vector3.new(0,updown*.8,1.4)
  984.  
  985. for i=1,#Legs,3 do
  986. local ang = 0;
  987. local ang2 = 0;
  988. local ang3 = 0;
  989. local time = tick()
  990. if i < #Legs/2 then -- front
  991. if i%6 == 1 then -- Right
  992. if th == 1 then
  993. if Speed <= WalkSpeed then -- walky
  994. ang = math.sin(time*WalkSin)*.15 + .05
  995. ang2 = -math.abs(math.cos(time*WalkSin/2))*.4
  996. elseif Speed <= TrotSpeed then
  997. ang = math.sin(time*TrotSin)*.5 + .4
  998. ang2 = -math.abs(math.cos(time*TrotSin/2))*1.7
  999. else
  1000. ang = math.sin(time*6)*.8 + .35
  1001. ang2 = -math.abs(math.cos(time*3))*1.8
  1002. end
  1003. elseif th == -1 then
  1004. ang = math.sin(time*6)*.3 +.25
  1005. time = time -.1
  1006. ang2 = -math.abs(math.sin(time*3))*1.3 +.2
  1007. else
  1008. ang = math.sin(tick()*2)*.5 + .5
  1009. ang2 = -math.abs(math.cos(tick()*1) )*1.5
  1010. ang3 = ang2
  1011. end
  1012. else -- left
  1013. if th == 1 then
  1014. if Speed <= WalkSpeed then -- walky
  1015. time = time + math.pi/WalkSin
  1016. ang = math.sin(time*WalkSin)*.15 + .05
  1017. ang2 = -math.abs(math.cos(time*WalkSin/2))*.4
  1018. elseif Speed <= TrotSpeed then
  1019. time = time + math.pi/TrotSin
  1020. ang = math.sin(time*TrotSin)*.5 + .4
  1021. ang2 = -math.abs(math.cos(time*TrotSin/2))*1.7
  1022. else
  1023. time = time + .15
  1024. ang = math.sin(time*6)*.8 + .35
  1025. ang2 = -math.abs(math.cos(time*3))*1.8
  1026. end
  1027. elseif th == -1 then
  1028. time = time + math.pi/2
  1029. ang = math.sin(time*6)*.3 +.25
  1030. time = time -.1
  1031. ang2 = -math.abs(math.sin(time*3))*1.3 +.2
  1032. else
  1033. end
  1034. end
  1035. else -- back
  1036. if i%6 == 1 then -- Right
  1037. if th == 1 then
  1038. if Speed <= WalkSpeed then -- walky
  1039. ang = math.sin(time*WalkSin)*.1 - .6
  1040. ang2 = math.abs(math.cos(time*WalkSin/2))*.5 + .4
  1041. elseif Speed <= TrotSpeed then
  1042. ang = math.sin(time*TrotSin)*.5 - .8
  1043. ang2 = math.abs(math.cos(time*TrotSin/2))*1.4 - .1
  1044. ang3 = ang2-1
  1045. else
  1046. time = time + math.pi/2
  1047. ang = math.sin(time*6)*.5 - .8
  1048. ang2 = math.abs(math.cos(time*3))*1.4 - .1
  1049. ang3 = ang2-1
  1050. end
  1051. elseif th == -1 then
  1052. ang = math.sin(time*6)*.2 - .6
  1053. time = time -.5
  1054. ang2 = math.abs(math.cos(time*3))*1.4 - .1
  1055. ang3 = math.sin(time*6)*.2
  1056. else
  1057. ang = -.5
  1058. ang2 = .65
  1059. ang3 = -.15
  1060. end
  1061. else -- left
  1062. if th == 1 then
  1063. if Speed <= WalkSpeed then -- walky
  1064. time = time + math.pi/WalkSin
  1065. ang = math.sin(time*WalkSin)*.1 - .7
  1066. ang2 = math.abs(math.cos(time*WalkSin/2))*.5 + .4
  1067. elseif Speed <= TrotSpeed then
  1068. time = time - math.pi/TrotSin
  1069. ang = math.sin(time*TrotSin)*.5 - .8
  1070. ang2 = math.abs(math.cos(time*TrotSin/2))*1.4 - .1
  1071. ang3 = ang2-1
  1072. else
  1073. time = time + math.pi/2 - .15
  1074. ang = math.sin(time*6)*.5 - .8
  1075. ang2 = math.abs(math.cos(time*3))*1.4 - .1
  1076. ang3 = ang2-1
  1077. end
  1078. elseif th == -1 then
  1079. time = time + math.pi/2
  1080. ang = math.sin(time*6)*.2 - .6
  1081. time = time -.5
  1082. ang2 = math.abs(math.cos(time*3))*1.4 - .1
  1083. ang3 = math.sin(time*6)*.2
  1084. else
  1085. ang = -.55
  1086. ang2 = .65
  1087. ang3 = -.1
  1088. end
  1089. end
  1090. end
  1091. Legs[i].C0 = clerp(Legs[i].C0,Legs0[i] * CFrame.Angles(ang,0,0), .2)
  1092. Legs[i+1].C0 =clerp(Legs[i+1].C0, Legs0[i+1] * CFrame.Angles(ang2,0,0), .2)
  1093. Legs[i+2].C0 = clerp(Legs[i+2].C0, Legs0[i+2] * CFrame.Angles(ang3,0,0), .2)
  1094. end
  1095.  
  1096. -- Reins
  1097. if ReinLineM and ReinLineM.Part1 and ReinLineM.Part1.Transparency < 1 then
  1098. local rHold = ReinsHold or CFrame.new(0,3.5,-2)
  1099. ReinSphereL.C0 = rHold*CFrame.new(-1.8,0,0) + Vector3.new(0,BreathSin*.05,0)
  1100. ReinSphereR.C0 = rHold*CFrame.new(1.8,0,0) + Vector3.new(0,BreathSin*.05,0)
  1101. local lp1 = Main.CFrame:pointToObjectSpace(ReinAnchorL.Position) + Vector3.new(-0.05,0,0)
  1102. local lp2 = ReinSphereL.C0.p
  1103. ReinLineL.C0 = CFrame.new(lp1:Lerp(lp2,.5),lp2)*CFrame.Angles(0,math.pi/2,0)
  1104. ReinLineL.Part1.Mesh.Scale = Vector3.new((lp2-lp1).magnitude/ReinLineL.Part1.Size.X,1,1)
  1105. local rp1 = Main.CFrame:pointToObjectSpace(ReinAnchorR.Position) + Vector3.new(0.05,0,0)
  1106. local rp2 = ReinSphereR.C0.p
  1107. ReinLineR.C0 = CFrame.new(rp1:Lerp(rp2,.5),rp2)*CFrame.Angles(0,math.pi/2,0)
  1108. ReinLineR.Part1.Mesh.Scale = Vector3.new((rp2-rp1).magnitude/ReinLineR.Part1.Size.X,1,1)
  1109. ReinLineM.C0 = CFrame.new(lp2:Lerp(rp2,.5),rp2)*CFrame.Angles(0,math.pi/2,0)
  1110. ReinLineM.Part1.Mesh.Scale = Vector3.new((rp2-lp2).magnitude/ReinLineM.Part1.Size.X,1,1)
  1111. end
  1112. for i,v in pairs(BackHairs) do
  1113. v.w.C0 = v.c0 * CFrame.Angles(math.sin(BreathSin+i)*.05,math.sin(BreathSin+i^2)*.05,math.sin(BreathSin+i^3)*.05) + Vector3.new(0,BreathSin*.05,0)
  1114. end
  1115.  
  1116. for i,v in pairs(TailHairs) do
  1117. v.w.C0 = v.c0 * CFrame.Angles(math.sin(TailSin+i)*.05,math.sin(TailSin+i^2)*.05,math.sin(TailSin+i^3)*.05)
  1118. end
  1119. for i,v in pairs(NeckHairs) do
  1120. v.w.C0 = v.c0 * CFrame.Angles(math.sin(BreathSin+i)*.05,math.sin(BreathSin+i^2)*.05,math.sin(BreathSin+i^3)*.05)
  1121. end
  1122. for i,v in pairs(HeadHairs) do
  1123. v.w.C0 = v.c0 * CFrame.Angles(math.sin(BreathSin+i)*.08,math.sin(BreathSin+i^2)*.08,math.sin(BreathSin+i^3)*.08)
  1124. end
  1125. end))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement