Advertisement
ConTheKoala

Horse Red n Blue

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