StrawberryMemester

Roblox Horse Script

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