Submiter55

Horse

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