Advertisement
DarkScriptZEditors

Untitled

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