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