Advertisement
BabyGoatz

Untitled

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