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