Advertisement
DaLittleTem

Untitled

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