Advertisement
SOCHILDISHHH

Horsee2

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