Wweroblox12121212

Untitled

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