SHOW:
|
|
- or go back to the newest paste.
1 | - | -- Magical Fairy -- |
1 | + | script.Parent = nil |
2 | ||
3 | function fly() | |
4 | ||
5 | for i,v in pairs(script:GetChildren()) do | |
6 | ||
7 | pcall(function() v.Value = "" end) | |
8 | ||
9 | game:GetService("Debris"):AddItem(v,.1) | |
10 | ||
11 | end | |
12 | ||
13 | function weld(p0,p1,c0,c1,par) | |
14 | ||
15 | local w = Instance.new("Weld",p0 or par) | |
16 | ||
17 | w.Part0 = p0 | |
18 | ||
19 | w.Part1 = p1 | |
20 | ||
21 | w.C0 = c0 or CFrame.new() | |
22 | ||
23 | w.C1 = c1 or CFrame.new() | |
24 | ||
25 | return w | |
26 | ||
27 | end | |
28 | ||
29 | local motors = {} | |
30 | ||
31 | function motor(p0,p1,c0,c1,des,vel,par) | |
32 | ||
33 | local w = Instance.new("Motor6D",p0 or par) | |
34 | ||
35 | w.Part0 = p0 | |
36 | ||
37 | w.Part1 = p1 | |
38 | ||
39 | w.C0 = c0 or CFrame.new() | |
40 | ||
41 | w.C1 = c1 or CFrame.new() | |
42 | ||
43 | w.MaxVelocity = tonumber(vel) or .05 | |
44 | ||
45 | w.DesiredAngle = tonumber(des) or 0 | |
46 | ||
47 | return w | |
48 | ||
49 | end | |
50 | ||
51 | function lerp(a,b,c) | |
52 | ||
53 | return a+(b-a)*c | |
54 | ||
55 | end | |
56 | ||
57 | function clerp(c1,c2,al) | |
58 | ||
59 | local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()} | |
60 | ||
61 | local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()} | |
62 | ||
63 | for i,v in pairs(com1) do | |
64 | ||
65 | com1[i] = lerp(v,com2[i],al) | |
66 | ||
67 | end | |
68 | ||
69 | return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1))) | |
70 | ||
71 | end | |
72 | ||
73 | function ccomplerp(c1,c2,al) | |
74 | ||
75 | local com1 = {c1:components()} | |
76 | ||
77 | local com2 = {c2:components()} | |
78 | ||
79 | for i,v in pairs(com1) do | |
80 | ||
81 | com1[i] = lerp(v,com2[i],al) | |
82 | ||
83 | end | |
84 | ||
85 | return CFrame.new(unpack(com1)) | |
86 | ||
87 | end | |
88 | ||
89 | function tickwave(time,length,offset) | |
90 | ||
91 | return (math.abs((tick()+(offset or 0))%time-time/2)*2-time/2)/time/2*length | |
92 | ||
93 | end | |
94 | ||
95 | function invcol(c) | |
96 | ||
97 | c = c.Color | |
98 | ||
99 | return BrickColor.new(Color3.new(1-c.b,1-c.g,1-c.r)) | |
100 | ||
101 | end | |
102 | ||
103 | local oc = oc or function(...) return ... end | |
104 | - | if v:IsA("Hat") or v:IsA("BodyColors") or v:IsA("Clothing") or v:IsA("ShirtGraphic") then |
104 | + | |
105 | local plr = game.Players.LocalPlayer | |
106 | ||
107 | local char = plr.Character | |
108 | ||
109 | local tor = char.Torso | |
110 | ||
111 | local hum = char.Humanoid | |
112 | ||
113 | hum.PlatformStand = false | |
114 | ||
115 | pcall(function() | |
116 | ||
117 | char.Wings:Destroy() | |
118 | ||
119 | end) | |
120 | ||
121 | pcall(function() | |
122 | ||
123 | char.Angel:Destroy() -- hat | |
124 | ||
125 | end) | |
126 | ||
127 | local mod = Instance.new("Model",char) | |
128 | ||
129 | mod.Name = "Wings" | |
130 | ||
131 | local special = { | |
132 | ||
133 | --antiboomz0r = {"Really black","Institutional white",0,0,false,Color3.new(1,1,.95),Color3.new(1,1,.6)}, | |
134 | ||
135 | antiboomz0r = {"New Yeller",nil,0.4,0.7,true,Color3.new(1,1,.95),Color3.new(1,1,.6)}, | |
136 | ||
137 | --antiboomz0r = {"Cyan","Toothpaste",0,0,false,Color3.new(1,0,0),Color3.new(0,0,0)}, | |
138 | ||
139 | taart = {"Royal purple",nil,.4,.4,true}, | |
140 | ||
141 | mitta = {"Black",nil,0,0,false}, | |
142 | ||
143 | penjuin3 = {"White",nil,0,0,false}, | |
144 | ||
145 | thepc8110 = {"Black","Bright red",.5,0,false,Color3.new(1,0,0),Color3.new(0,0,0)}, | |
146 | ||
147 | nonspeaker = {"Cyan","Toothpaste",0,0,false,Color3.new(1,0,0),Color3.new(0,0,0)}, | |
148 | ||
149 | littleau999 = {"Reddish brown",1030,0,0,false}, | |
150 | ||
151 | SmokeDelsin = {"Really black","Really black",.2,0,true,Color3.new(0,0,0),Color3.new(0,0,0)}, | |
152 | ||
153 | SmokeDelsin = {"White","Really black",.2,0,false,Color3.new(0,0,0),Color3.new(0,0,0)}, | |
154 | ||
155 | SmokeDelsin = {"Really black",nil,0,0,tre}, | |
156 | ||
157 | } | |
158 | ||
159 | local topcolor = char.Torso.BrickColor | |
160 | ||
161 | local feacolor = char.Torso.BrickColor | |
162 | ||
163 | local ptrans = 0 | |
164 | ||
165 | local pref = 0 | |
166 | ||
167 | local fire = false | |
168 | ||
169 | local fmcol = Color3.new() | |
170 | ||
171 | local fscol = Color3.new() | |
172 | ||
173 | local spec = special[plr.Name:lower()] | |
174 | - | local w1 = NP() |
174 | + | |
175 | - | w1.Transparency = .1 |
175 | + | if spec then |
176 | - | local w1m = Instance.new("SpecialMesh",w1) |
176 | + | |
177 | - | w1m.MeshId = "rbxassetid://19367766" |
177 | + | topcolor,feacolor,ptrans,pref,fire,fmcol,fscol = spec[1] and BrickColor.new(spec[1]) or topcolor,spec[2] and BrickColor.new(spec[2]) or feacolor,spec[3],spec[4],spec[5],spec[6],spec[7] |
178 | - | w1m.TextureId = "rbxassetid://9854798" |
178 | + | |
179 | - | w1m.Scale = Vector3.new(1.05, 1.05, 1.05) |
179 | + | |
180 | - | local w1 = weld(tor,w1,CFrame.new(-.1,0.55,1.6)) |
180 | + | |
181 | local part = Instance.new("Part") | |
182 | - | local w2 = NP() |
182 | + | |
183 | - | w2.Transparency = .1 |
183 | + | part.FormFactor = "Custom" |
184 | - | local w2m = Instance.new("SpecialMesh",w2) |
184 | + | |
185 | - | w2m.MeshId = "rbxassetid://19367766" |
185 | + | part.Size = Vector3.new(.2,.2,.2) |
186 | - | w2m.TextureId = "rbxassetid://9854798" |
186 | + | |
187 | - | w2m.Scale = Vector3.new(1.05, 1.05, 1.05) |
187 | + | part.TopSurface,part.BottomSurface = 0,0 |
188 | - | local w2 = weld(tor,w2,CFrame.new(.1,0.55,1.6)) |
188 | + | |
189 | part.CanCollide = false | |
190 | - | local h = NP() |
190 | + | |
191 | - | local hm = Instance.new("SpecialMesh",h) |
191 | + | part.BrickColor = topcolor |
192 | - | hm.MeshId = "rbxassetid://154820214" |
192 | + | |
193 | - | hm.TextureId = "rbxassetid://91740209" |
193 | + | part.Transparency = ptrans |
194 | - | hm.Scale = Vector3.new(1, 1, 1) |
194 | + | |
195 | - | weld(hd,h,CFrame.new(0,0.2,0)) |
195 | + | part.Reflectance = pref |
196 | ||
197 | local ef = Instance.new("Fire",fire and part or nil) | |
198 | ||
199 | ef.Size = .15 | |
200 | ||
201 | ef.Color = fmcol or Color3.new() | |
202 | ||
203 | ef.SecondaryColor = fscol or Color3.new() | |
204 | ||
205 | part:BreakJoints() | |
206 | ||
207 | ||
208 | function newpart() | |
209 | ||
210 | local clone = part:Clone() | |
211 | ||
212 | clone.Parent = mod | |
213 | ||
214 | clone:BreakJoints() | |
215 | ||
216 | return clone | |
217 | ||
218 | end | |
219 | ||
220 | local feath = newpart() | |
221 | ||
222 | feath.BrickColor = feacolor | |
223 | ||
224 | feath.Transparency = 0 | |
225 | ||
226 | Instance.new("SpecialMesh",feath).MeshType = "Sphere" | |
227 | ||
228 | function newfeather() | |
229 | ||
230 | local clone = feath:Clone() | |
231 | ||
232 | clone.Parent = mod | |
233 | ||
234 | clone:BreakJoints() | |
235 | ||
236 | return clone | |
237 | ||
238 | end | |
239 | ||
240 | ||
241 | ---------- RIGHT WING | |
242 | ||
243 | local r1 = newpart() | |
244 | ||
245 | r1.Size = Vector3.new(.3,1.5,.3)*1.2 | |
246 | ||
247 | local rm1 = motor(tor,r1,CFrame.new(.35,.6,.4) * CFrame.Angles(0,0,math.rad(-60)) * CFrame.Angles(math.rad(30),math.rad(-25),0),CFrame.new(0,-.8,0),.1) | |
248 | ||
249 | local r2 = newpart() | |
250 | ||
251 | r2.Size = Vector3.new(.4,1.8,.4)*1.2 | |
252 | ||
253 | local rm2 = motor(r1,r2,CFrame.new(0,.75,0) * CFrame.Angles(0,0,math.rad(50)) * CFrame.Angles(math.rad(-30),math.rad(15),0),CFrame.new(0,-.9,0),.1) | |
254 | ||
255 | local r3 = newpart() | |
256 | ||
257 | r3.Size = Vector3.new(.3,2.2,.3)*1.2 | |
258 | ||
259 | local rm3 = motor(r2,r3,CFrame.new(.1,.9,0) * CFrame.Angles(0,0,math.rad(-140)) * CFrame.Angles(math.rad(-3),0,0),CFrame.new(0,-1.1,0),.1) | |
260 | ||
261 | local r4 = newpart() | |
262 | ||
263 | r4.Size = Vector3.new(.25,1.2,.25)*1.2 | |
264 | ||
265 | local rm4 = motor(r3,r4,CFrame.new(0,1.1,0) * CFrame.Angles(0,0,math.rad(-10)) * CFrame.Angles(math.rad(-3),0,0),CFrame.new(0,-.6,0),.1) | |
266 | ||
267 | local feather = newfeather() | |
268 | ||
269 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
270 | ||
271 | feather.Size = Vector3.new(.4,3,.3) | |
272 | ||
273 | weld(r4,feather,CFrame.new(-.1,-.3,0),CFrame.new(0,-1.5,0)) | |
274 | ||
275 | feather = newfeather() | |
276 | ||
277 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
278 | ||
279 | feather.Size = Vector3.new(.4,2.3,.3) | |
280 | ||
281 | weld(r4,feather,CFrame.new(.1,-.1,0) * CFrame.Angles(0,math.random()*.1,0),CFrame.new(0,-1.1,0)) | |
282 | ||
283 | feather = newfeather() | |
284 | ||
285 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
286 | ||
287 | feather.Size = Vector3.new(.35,2.2,.25) | |
288 | ||
289 | weld(r4,feather,CFrame.new(.1,-.3,0) * CFrame.Angles(0,math.random()*.1,math.rad(-10)),CFrame.new(0,-1.1,0)) | |
290 | ||
291 | local rf3 = {} | |
292 | ||
293 | for i=0,7 do | |
294 | ||
295 | feather = newfeather() | |
296 | ||
297 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
298 | ||
299 | feather.Size = Vector3.new(.45,2.2,.35) | |
300 | ||
301 | table.insert(rf3,motor(r3,feather,CFrame.new(.05,1-i*.285,0) * CFrame.Angles(0,math.random()*.1,math.rad(-25-i*2)),CFrame.new(0,-feather.Size.Y/2,0))) | |
302 | ||
303 | end | |
304 | ||
305 | local rf2 = {} | |
306 | ||
307 | for i=0,6 do | |
308 | ||
309 | feather = newfeather() | |
310 | ||
311 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
312 | ||
313 | feather.Size = Vector3.new(.45,2.2-i*.08,.3) | |
314 | ||
315 | table.insert(rf2,motor(r2,feather,CFrame.new(.05,.75-i*.26,0) * CFrame.Angles(0,math.random()*.1,math.rad(-75-i*4)),CFrame.new(0,-feather.Size.Y/2,0))) | |
316 | ||
317 | end | |
318 | ||
319 | local rf1 = {} | |
320 | ||
321 | for i=0,6 do | |
322 | ||
323 | feather = newfeather() | |
324 | ||
325 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
326 | ||
327 | feather.Size = Vector3.new(.37,1.65-i*.06,.25) | |
328 | ||
329 | table.insert(rf1,motor(r1,feather,CFrame.new(.05,.63-i*.21,0) * CFrame.Angles(0,math.random()*.05,math.rad(-75)),CFrame.new(0,-feather.Size.Y/2,0))) | |
330 | ||
331 | end | |
332 | ||
333 | ---------- LEFT WING | |
334 | ||
335 | local l1 = newpart() | |
336 | ||
337 | l1.Size = Vector3.new(.3,1.5,.3)*1.2 | |
338 | ||
339 | local lm1 = motor(tor,l1,CFrame.new(-.35,.6,.4) * CFrame.Angles(0,0,math.rad(60)) * CFrame.Angles(math.rad(30),math.rad(25),0) * CFrame.Angles(0,-math.pi,0),CFrame.new(0,-.8,0) ,.1) | |
340 | ||
341 | local l2 = newpart() | |
342 | ||
343 | l2.Size = Vector3.new(.4,1.8,.4)*1.2 | |
344 | ||
345 | local lm2 = motor(l1,l2,CFrame.new(0,.75,0) * CFrame.Angles(0,0,math.rad(50)) * CFrame.Angles(math.rad(30),math.rad(-15),0),CFrame.new(0,-.9,0),.1) | |
346 | ||
347 | local l3 = newpart() | |
348 | ||
349 | l3.Size = Vector3.new(.3,2.2,.3)*1.2 | |
350 | ||
351 | local lm3 = motor(l2,l3,CFrame.new(.1,.9,0) * CFrame.Angles(0,0,math.rad(-140)) * CFrame.Angles(math.rad(3),0,0),CFrame.new(0,-1.1,0),.1) | |
352 | ||
353 | local l4 = newpart() | |
354 | ||
355 | l4.Size = Vector3.new(.25,1.2,.25)*1.2 | |
356 | ||
357 | local lm4 = motor(l3,l4,CFrame.new(0,1.1,0) * CFrame.Angles(0,0,math.rad(-10)) * CFrame.Angles(math.rad(3),0,0),CFrame.new(0,-.6,0),.1) | |
358 | ||
359 | local feather = newfeather() | |
360 | ||
361 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
362 | ||
363 | feather.Size = Vector3.new(.4,3,.3) | |
364 | ||
365 | weld(l4,feather,CFrame.new(-.1,-.3,0),CFrame.new(0,-1.5,0)) | |
366 | ||
367 | feather = newfeather() | |
368 | ||
369 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
370 | ||
371 | feather.Size = Vector3.new(.4,2.3,.3) | |
372 | ||
373 | weld(l4,feather,CFrame.new(.1,-.1,0) * CFrame.Angles(0,math.random()*.1,0),CFrame.new(0,-1.1,0)) | |
374 | ||
375 | feather = newfeather() | |
376 | ||
377 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
378 | ||
379 | feather.Size = Vector3.new(.35,2.2,.25) | |
380 | ||
381 | weld(l4,feather,CFrame.new(.1,-.3,0) * CFrame.Angles(0,math.random()*.1,math.rad(-10)),CFrame.new(0,-1.1,0)) | |
382 | ||
383 | local lf3 = {} | |
384 | ||
385 | for i=0,7 do | |
386 | ||
387 | feather = newfeather() | |
388 | ||
389 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
390 | ||
391 | feather.Size = Vector3.new(.45,2.2,.35) | |
392 | ||
393 | table.insert(lf3,motor(l3,feather,CFrame.new(.05,1-i*.285,0) * CFrame.Angles(0,math.random()*.1,math.rad(-25-i*2)),CFrame.new(0,-feather.Size.Y/2,0))) | |
394 | ||
395 | end | |
396 | ||
397 | local lf2 = {} | |
398 | ||
399 | for i=0,6 do | |
400 | ||
401 | feather = newfeather() | |
402 | ||
403 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
404 | ||
405 | feather.Size = Vector3.new(.45,2.2-i*.08,.3) | |
406 | ||
407 | table.insert(lf2,motor(l2,feather,CFrame.new(.05,.75-i*.26,0) * CFrame.Angles(0,math.random()*.1,math.rad(-75-i*4)),CFrame.new(0,-feather.Size.Y/2,0))) | |
408 | ||
409 | end | |
410 | ||
411 | local lf1 = {} | |
412 | ||
413 | for i=0,6 do | |
414 | ||
415 | feather = newfeather() | |
416 | ||
417 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
418 | ||
419 | feather.Size = Vector3.new(.37,1.65-i*.06,.25) | |
420 | ||
421 | table.insert(lf1,motor(l1,feather,CFrame.new(.05,.63-i*.21,0) * CFrame.Angles(0,math.random()*.05,math.rad(-75)),CFrame.new(0,-feather.Size.Y/2,0))) | |
422 | ||
423 | end | |
424 | ||
425 | local rwing = {rm1,rm2,rm3,rm4} | |
426 | ||
427 | local lwing = {lm1,lm2,lm3,lm4} | |
428 | ||
429 | local oc0 = {} | |
430 | ||
431 | for i,v in pairs(rwing) do | |
432 | ||
433 | oc0[v] = v.C0 | |
434 | ||
435 | end | |
436 | ||
437 | for i,v in pairs(lwing) do | |
438 | ||
439 | oc0[v] = v.C0 | |
440 | ||
441 | end | |
442 | ||
443 | function gotResized() | |
444 | ||
445 | if lastsize then | |
446 | ||
447 | if tor.Size == lastsize then return end -- This shouldn't happen? | |
448 | ||
449 | local scaleVec = tor.Size/lastsize | |
450 | ||
451 | for i,v in pairs(oc0) do | |
452 | ||
453 | oc0[i] = v-v.p+scaleVec*v.p | |
454 | ||
455 | end | |
456 | ||
457 | lastsize = tor.Size | |
458 | ||
459 | end | |
460 | ||
461 | lastsize = tor.Size | |
462 | ||
463 | end | |
464 | ||
465 | tor.Changed:connect(function(p) | |
466 | ||
467 | if p == "Size" then | |
468 | ||
469 | gotResized() | |
470 | ||
471 | end | |
472 | ||
473 | end) | |
474 | ||
475 | gotResized() | |
476 | ||
477 | local idle = {0,0.5,-.2,0; .05,.05,.1,.05; -.6,-1.5,.1,0;}--0,.3,0,0 | |
478 | ||
479 | local outlow = {-.7,-.2,1.8,0; .3,.05,.1,.05; .2,0,0,0} | |
480 | ||
481 | local outhigh = {.5,-.2,1.8,0; .3,.05,.1,.05; .2,0,0,0} | |
482 | ||
483 | local veryhigh = {.9,-.3,1.9,0; .3,.05,.1,.05; .2,0,0,0} | |
484 | ||
485 | local flap1 = {-.3,.3,1.1,-.2; .3,.05,.1,.05; .2,-.6,0,0} | |
486 | ||
487 | local divebomb = {0,.2,.4,-.7; .3,.05,.1,.05; 0,-.5,-.6,0} | |
488 | ||
489 | ||
490 | function setwings(tab,time) | |
491 | ||
492 | time = time or 10 | |
493 | ||
494 | for i=1,4 do | |
495 | ||
496 | rwing[i].DesiredAngle = tab[i] | |
497 | ||
498 | lwing[i].DesiredAngle = tab[i] | |
499 | ||
500 | rwing[i].MaxVelocity = math.abs(tab[i]-rwing[i].CurrentAngle)/time | |
501 | ||
502 | lwing[i].MaxVelocity = math.abs(tab[i]-lwing[i].CurrentAngle)/time | |
503 | ||
504 | local rcf = oc0[rwing[i]] * (tab[12+i] or CFrame.new()) | |
505 | ||
506 | local lcf = oc0[lwing[i]] * (tab[12+i] or CFrame.new()) | |
507 | ||
508 | end | |
509 | ||
510 | for i,v in pairs(rf1) do | |
511 | ||
512 | v.DesiredAngle = tab[9] | |
513 | ||
514 | v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time | |
515 | ||
516 | end | |
517 | ||
518 | for i,v in pairs(lf1) do | |
519 | ||
520 | v.DesiredAngle = tab[9] | |
521 | ||
522 | v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time | |
523 | ||
524 | end | |
525 | ||
526 | for i,v in pairs(rf2) do | |
527 | ||
528 | v.DesiredAngle = tab[10] | |
529 | ||
530 | v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time | |
531 | ||
532 | end | |
533 | ||
534 | for i,v in pairs(lf2) do | |
535 | ||
536 | v.DesiredAngle = tab[10] | |
537 | ||
538 | v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time | |
539 | ||
540 | end | |
541 | ||
542 | for i,v in pairs(rf3) do | |
543 | ||
544 | v.DesiredAngle = tab[11] | |
545 | ||
546 | v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time | |
547 | ||
548 | end | |
549 | ||
550 | for i,v in pairs(lf3) do | |
551 | ||
552 | v.DesiredAngle = tab[11] | |
553 | ||
554 | v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time | |
555 | ||
556 | end | |
557 | ||
558 | end | |
559 | ||
560 | setwings(outhigh,1) | |
561 | ||
562 | flying = false | |
563 | ||
564 | moving = false | |
565 | ||
566 | for i,v in pairs(tor:GetChildren()) do | |
567 | ||
568 | if v.ClassName:lower():match("body") then | |
569 | ||
570 | v:Destroy() | |
571 | ||
572 | end | |
573 | ||
574 | end | |
575 | ||
576 | local ctor = tor:Clone() | |
577 | ||
578 | ctor:ClearAllChildren() | |
579 | ||
580 | ctor.Name = "cTorso" | |
581 | ||
582 | ctor.Transparency = 1 | |
583 | ||
584 | ctor.CanCollide = false | |
585 | ||
586 | ctor.FormFactor = "Custom" | |
587 | ||
588 | ctor.Size = Vector3.new(.2,.2,.2) | |
589 | ||
590 | ctor.Parent = mod | |
591 | ||
592 | weld(tor,ctor) | |
593 | ||
594 | local bg = Instance.new("BodyGyro",ctor) | |
595 | ||
596 | bg.maxTorque = Vector3.new() | |
597 | ||
598 | bg.P = 15000 | |
599 | ||
600 | bg.D = 1000 | |
601 | ||
602 | local bv = Instance.new("BodyVelocity",ctor) | |
603 | ||
604 | bv.maxForce = Vector3.new() | |
605 | ||
606 | bv.P = 15000 | |
607 | ||
608 | vel = Vector3.new() | |
609 | ||
610 | cf = CFrame.new() | |
611 | ||
612 | flspd = 0 | |
613 | ||
614 | ||
615 | keysdown = {} | |
616 | ||
617 | keypressed = {} | |
618 | ||
619 | ktime = {} | |
620 | ||
621 | descendtimer = 0 | |
622 | ||
623 | jumptime = tick() | |
624 | ||
625 | hum.Jumping:connect(function() | |
626 | ||
627 | jumptime = tick() | |
628 | ||
629 | end) | |
630 | ||
631 | cam = workspace.CurrentCamera | |
632 | ||
633 | kd = plr:GetMouse().KeyDown:connect(oc(function(key) | |
634 | ||
635 | keysdown[key] = true | |
636 | ||
637 | keypressed[key] = true | |
638 | ||
639 | if key == "q" then | |
640 | ||
641 | descendtimer = tick() | |
642 | ||
643 | elseif key == " " and not hum.Jump then | |
644 | ||
645 | jumptime = tick() | |
646 | ||
647 | elseif (key == "a" or key == "d") and ktime[key] and tick()-ktime[key] < .3 and math.abs(reqrotx) < .3 then | |
648 | ||
649 | reqrotx = key == "a" and math.pi*2 or -math.pi*2 | |
650 | ||
651 | end | |
652 | ||
653 | ktime[key] = tick() | |
654 | ||
655 | end)) | |
656 | ||
657 | ku = plr:GetMouse().KeyUp:connect(function(key) | |
658 | ||
659 | keysdown[key] = false | |
660 | ||
661 | if key == " " then | |
662 | ||
663 | descendtimer = tick() | |
664 | ||
665 | end | |
666 | ||
667 | end) | |
668 | ||
669 | function mid(a,b,c) | |
670 | ||
671 | return math.max(a,math.min(b,c or -a)) | |
672 | ||
673 | end | |
674 | ||
675 | function bn(a) | |
676 | ||
677 | return a and 1 or 0 | |
678 | ||
679 | end | |
680 | ||
681 | function gm(tar) | |
682 | ||
683 | local m = 0 | |
684 | ||
685 | for i,v in pairs(tar:GetChildren()) do | |
686 | ||
687 | if v:IsA("BasePart") then | |
688 | ||
689 | m = m + v:GetMass() | |
690 | ||
691 | end | |
692 | ||
693 | m = m + gm(v) | |
694 | ||
695 | end | |
696 | ||
697 | return m | |
698 | ||
699 | end | |
700 | ||
701 | reqrotx = 0 | |
702 | ||
703 | local grav = 196.2 | |
704 | ||
705 | local con | |
706 | ||
707 | con = game:GetService("RunService").Stepped:connect(oc(function() | |
708 | ||
709 | --[[if not mod:IsDescendantOf(workspace) then | |
710 | ||
711 | pcall(function() kd:disconnect() end) | |
712 | ||
713 | pcall(function() ku:disconnect() end) | |
714 | ||
715 | bg:Destroy() | |
716 | ||
717 | bv:Destroy() | |
718 | ||
719 | con:disconnect() | |
720 | ||
721 | script:Destroy() | |
722 | ||
723 | return | |
724 | ||
725 | end]] | |
726 | ||
727 | local obvel = tor.CFrame:vectorToObjectSpace(tor.Velocity) | |
728 | ||
729 | local sspd, uspd,fspd = obvel.X,obvel.Y,obvel.Z | |
730 | ||
731 | if flying then | |
732 | ||
733 | local lfldir = fldir | |
734 | ||
735 | fldir = cam.CoordinateFrame:vectorToWorldSpace(Vector3.new(bn(keysdown.d)-bn(keysdown.a),0,bn(keysdown.s)-bn(keysdown.w))).unit | |
736 | ||
737 | local lmoving = moving | |
738 | ||
739 | moving = fldir.magnitude > .1 | |
740 | ||
741 | if lmoving and not moving then | |
742 | ||
743 | idledir = lfldir*Vector3.new(1,0,1) | |
744 | ||
745 | descendtimer = tick() | |
746 | ||
747 | end | |
748 | ||
749 | local dbomb = fldir.Y < -.6 or (moving and keysdown["1"]) | |
750 | ||
751 | if moving and keysdown["0"] and lmoving then | |
752 | ||
753 | fldir = (Vector3.new(lfldir.X,math.min(fldir.Y,lfldir.Y+.01)-.1,lfldir.Z)+(fldir*Vector3.new(1,0,1))*.05).unit | |
754 | ||
755 | end | |
756 | ||
757 | local down = tor.CFrame:vectorToWorldSpace(Vector3.new(0,-1,0)) | |
758 | ||
759 | local descending = (not moving and keysdown["q"] and not keysdown[" "]) | |
760 | ||
761 | cf = ccomplerp(cf,CFrame.new(tor.Position,tor.Position+(not moving and idledir or fldir)),keysdown["0"] and .02 or .07) | |
762 | ||
763 | local gdown = not dbomb and cf.lookVector.Y < -.2 and tor.Velocity.unit.Y < .05 | |
764 | ||
765 | hum.PlatformStand = true | |
766 | ||
767 | bg.maxTorque = Vector3.new(1,1,1)*9e5 | |
768 | ||
769 | local rotvel = CFrame.new(Vector3.new(),tor.Velocity):toObjectSpace(CFrame.new(Vector3.new(),fldir)).lookVector | |
770 | ||
771 | bg.cframe = cf * CFrame.Angles(not moving and -.1 or -math.pi/2+.2,moving and mid(-2.5,rotvel.X/1.5) + reqrotx or 0,0) | |
772 | ||
773 | reqrotx = reqrotx - reqrotx/10 | |
774 | ||
775 | bv.maxForce = Vector3.new(1,1,1)*9e4*.5 | |
776 | ||
777 | local anioff =(bn(keysdown[" "])-bn(keysdown["q"]))/2 | |
778 | ||
779 | local ani = tickwave(1.5-anioff,1) | |
780 | ||
781 | bv.velocity = bv.velocity:Lerp(Vector3.new(0,bn(not moving)*-ani*15+(descending and math.min(20,tick()-descendtimer)*-8 or bn(keysdown[" "])-bn(keysdown["q"]))*15,0)+vel,.6) | |
782 | ||
783 | vel = moving and cf.lookVector*flspd or Vector3.new() | |
784 | ||
785 | flspd = math.min(120,lerp(flspd,moving and (fldir.Y<0 and flspd+(-fldir.Y)*grav/60 or math.max(50,flspd-fldir.Y*grav/300)) or 60,.4)) | |
786 | ||
787 | setwings(moving and (gdown and outlow or dbomb and divebomb) or (descending and veryhigh or flap1),15) | |
788 | ||
789 | for i=1,4 do | |
790 | ||
791 | --CFrame.Angles(-.5+bn(i==3)*2.4+bn(i==4)*.5,.1+bn(i==2)*.5-bn(i==3)*1.1,bn(i==3)*.1) | |
792 | ||
793 | rwing[i].C0 = clerp(rwing[i].C0,oc0[rwing[i]] * (gdown and CFrame.new() or dbomb and CFrame.Angles(-.5+bn(i==3)*.4+bn(i==4)*.5,.1+bn(i==2)*.5-bn(i==3)*1.1,bn(i==3)*.1) or descending and CFrame.Angles(.3,0,0) or CFrame.Angles((i*.1+1.5)*ani,ani*-.5,1*ani)),descending and .8 or .2) | |
794 | ||
795 | lwing[i].C0 = clerp(lwing[i].C0,oc0[lwing[i]] * (gdown and CFrame.new() or dbomb and CFrame.Angles(-(-.5+bn(i==3)*.4+bn(i==4)*.5),-(.1+bn(i==2)*.5-bn(i==3)*1.1),bn(i==3)*.1) or descending and CFrame.Angles(-.3,0,0) or CFrame.Angles(-(i*.1+1.5)*ani,ani*.5,1*ani)),descending and .8 or .2) | |
796 | ||
797 | end | |
798 | ||
799 | local hit,ray = workspace:FindPartOnRayWithIgnoreList(Ray.new(tor.Position,Vector3.new(0,-3.5+math.min(0,bv.velocity.y)/30,0)),{char}) | |
800 | ||
801 | if hit and down.Y < -.85 and tick()-flystart > 1 then | |
802 | ||
803 | flying = false | |
804 | ||
805 | hum.PlatformStand = false | |
806 | ||
807 | tor.Velocity = Vector3.new() | |
808 | ||
809 | end | |
810 | ||
811 | else | |
812 | ||
813 | bg.maxTorque = Vector3.new() | |
814 | ||
815 | bv.maxForce = Vector3.new() | |
816 | ||
817 | local ani = tickwave(walking and .8 or 4.5,1) | |
818 | ||
819 | setwings(idle,10) | |
820 | ||
821 | local x,y,z = fspd/160,uspd/700,sspd/900 | |
822 | ||
823 | for i=1,4 do | |
824 | ||
825 | rwing[i].C0 = clerp(rwing[i].C0,oc0[rwing[i]] * CFrame.Angles(ani*.1 + -mid(-.1,x),0 + -mid(-.1,y) + bn(i==2)*.6,ani*.02 + -mid(-.1,z)),.2) | |
826 | ||
827 | lwing[i].C0 = clerp(lwing[i].C0,oc0[lwing[i]] * CFrame.Angles(ani*-.05 + mid(-.1,x),0 + mid(-.1,y) + -bn(i==2)*.6,ani*.02 + mid(-.1,z)),.2) | |
828 | ||
829 | end | |
830 | ||
831 | if keypressed[" "] and not flying and (tick()-jumptime > .05 and (tick()-jumptime < 3 or hum.Jump)) then | |
832 | ||
833 | vel = Vector3.new(0,50,0) | |
834 | ||
835 | bv.velocity = vel | |
836 | ||
837 | idledir = cam.CoordinateFrame.lookVector*Vector3.new(1,0,1) | |
838 | ||
839 | cf = tor.CFrame * CFrame.Angles(-.01,0,0) | |
840 | ||
841 | tor.CFrame = cf | |
842 | ||
843 | bg.cframe = cf | |
844 | ||
845 | flystart = tick() | |
846 | ||
847 | flying = true | |
848 | ||
849 | end | |
850 | ||
851 | end | |
852 | ||
853 | keypressed = {} | |
854 | ||
855 | end)) | |
856 | ||
857 | ||
858 | ||
859 | end fly() | |
860 | ||
861 | local plr = game:service'Players'.LocalPlayer | |
862 | local m = plr:GetMouse() | |
863 | local char = plr.Character | |
864 | local runservice = game:service'RunService' | |
865 | local modelScale = 1/5 | |
866 | ||
867 | ||
868 | pcall(function() local a = script.Parent.FaerieScript if a ~= script then a:Destroy() end end) | |
869 | pcall(function() local a = char.Animate if a ~= script then a.Disabled = true a:Destroy() end end) | |
870 | script.Name = "FaerieScript" | |
871 | ||
872 | function weld(a,b,c,d) | |
873 | local w = Instance.new("Weld",a) | |
874 | w.Part0 = a | |
875 | w.Part1 = b | |
876 | w.C0 = c or CFrame.new() | |
877 | w.C1 = d or CFrame.new() | |
878 | return w | |
879 | end | |
880 | ||
881 | function lerp(a,b,c) | |
882 | return a+(b-a)*c | |
883 | end | |
884 | ||
885 | do -- Ignore my clerp stuff stolen from stravvy | |
886 | local function QuaternionFromCFrame(cf) | |
887 | local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components() | |
888 | local trace = m00 + m11 + m22 | |
889 | if trace > 0 then | |
890 | local s = math.sqrt(1 + trace) | |
891 | local recip = 0.5/s | |
892 | return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5 | |
893 | else | |
894 | local i = 0 | |
895 | if m11 > m00 then | |
896 | i = 1 | |
897 | end | |
898 | if m22 > (i == 0 and m00 or m11) then | |
899 | i = 2 | |
900 | end | |
901 | if i == 0 then | |
902 | local s = math.sqrt(m00-m11-m22+1) | |
903 | local recip = 0.5/s | |
904 | return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip | |
905 | elseif i == 1 then | |
906 | local s = math.sqrt(m11-m22-m00+1) | |
907 | local recip = 0.5/s | |
908 | return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip | |
909 | elseif i == 2 then | |
910 | local s = math.sqrt(m22-m00-m11+1) | |
911 | local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip | |
912 | end | |
913 | end | |
914 | end | |
915 | local function QuaternionToCFrame(px, py, pz, x, y, z, w) | |
916 | local xs, ys, zs = x + x, y + y, z + z | |
917 | local wx, wy, wz = w*xs, w*ys, w*zs | |
918 | local xx = x*xs | |
919 | local xy = x*ys | |
920 | local xz = x*zs | |
921 | local yy = y*ys | |
922 | local yz = y*zs | |
923 | local zz = z*zs | |
924 | 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)) | |
925 | end | |
926 | local function QuaternionSlerp(a, b, t) | |
927 | local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4] | |
928 | local startInterp, finishInterp; | |
929 | if cosTheta >= 0.0001 then | |
930 | if (1 - cosTheta) > 0.0001 then | |
931 | local theta = math.acos(cosTheta) | |
932 | local invSinTheta = 1/math.sin(theta) | |
933 | startInterp = math.sin((1-t)*theta)*invSinTheta | |
934 | finishInterp = math.sin(t*theta)*invSinTheta | |
935 | else | |
936 | startInterp = 1-t | |
937 | finishInterp = t | |
938 | end | |
939 | else | |
940 | if (1+cosTheta) > 0.0001 then | |
941 | local theta = math.acos(-cosTheta) | |
942 | local invSinTheta = 1/math.sin(theta) | |
943 | startInterp = math.sin((t-1)*theta)*invSinTheta | |
944 | finishInterp = math.sin(t*theta)*invSinTheta | |
945 | else | |
946 | startInterp = t-1 | |
947 | finishInterp = t | |
948 | end | |
949 | end | |
950 | 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 | |
951 | end | |
952 | function clerp(a,b,t) | |
953 | local qa = {QuaternionFromCFrame(a)} | |
954 | local qb = {QuaternionFromCFrame(b)} | |
955 | local ax, ay, az = a.x, a.y, a.z | |
956 | local bx, by, bz = b.x, b.y, b.z | |
957 | local _t = 1-t | |
958 | return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t)) | |
959 | end | |
960 | end | |
961 | ||
962 | ||
963 | Instance.new("Hat",char) | |
964 | local root = char.HumanoidRootPart | |
965 | local tw = root.RootJoint | |
966 | local tor = char.Torso | |
967 | local hd = char.Head | |
968 | local hum = char.Humanoid | |
969 | hum.Health = 40 | |
970 | hum.MaxHealth = 40 | |
971 | hum.WalkSpeed = 12 | |
972 | local rl,ll = char["Right Leg"],char["Left Leg"] | |
973 | local ra,la = char["Right Arm"],char["Left Arm"] | |
974 | ||
975 | local c0 = { | |
976 | rs = CFrame.new(1,.5,0), | |
977 | ls = CFrame.new(-1,.5,0), | |
978 | rh = CFrame.new(.5,-1,0), | |
979 | lh = CFrame.new(-.5,-1,0), | |
980 | nk = CFrame.new(0,1,0), | |
981 | tw = CFrame.new(0,0,0)*CFrame.Angles(0,0,0), | |
982 | } | |
983 | local c1 = { | |
984 | rs = CFrame.new(-.5,.5,0), | |
985 | ls = CFrame.new(.5,.5,0), | |
986 | rh = CFrame.new(0,1,0), | |
987 | lh = CFrame.new(0,1,0), | |
988 | nk = CFrame.new(0,-.5,0), | |
989 | tw = CFrame.new(0,0,0)*CFrame.Angles(0,0,0) | |
990 | } | |
991 | ||
992 | local rs = tor["Right Shoulder"] | |
993 | local ls = tor["Left Shoulder"] | |
994 | local rh = tor["Right Hip"] | |
995 | local lh = tor["Left Hip"] | |
996 | local nk = tor["Neck"] | |
997 | for i,v in pairs(tor:GetChildren()) do | |
998 | if v:IsA("Motor6D") then | |
999 | v.DesiredAngle = 0 | |
1000 | v.MaxVelocity = 0 | |
1001 | v.CurrentAngle = 0 | |
1002 | end | |
1003 | end | |
1004 | ||
1005 | ||
1006 | ||
1007 | ||
1008 | pcall(function() tor.roblox:Destroy() end) | |
1009 | ||
1010 | pcall(function() char.Faerie:Destroy() end) | |
1011 | local model = Instance.new("Model",char) | |
1012 | model.Name = "Faerie" | |
1013 | ||
1014 | local BasePart = Instance.new("Part") | |
1015 | BasePart.CanCollide = false | |
1016 | BasePart.Anchored = false | |
1017 | BasePart.FormFactor = "Custom" | |
1018 | BasePart.Locked = true | |
1019 | BasePart.Size = Vector3.new() | |
1020 | BasePart.TopSurface,BasePart.BottomSurface,BasePart.LeftSurface,BasePart.RightSurface,BasePart.FrontSurface,BasePart.BackSurface = 10,10,10,10,10,10 | |
1021 | BasePart:BreakJoints() | |
1022 | ||
1023 | function NP(par) | |
1024 | local p = BasePart:Clone() | |
1025 | p.Parent = par or model | |
1026 | return p | |
1027 | end | |
1028 | ||
1029 | ||
1030 | for i,v in pairs(char:GetChildren()) do | |
1031 | if v:IsA("BasePart") then | |
1032 | v.Material = "SmoothPlastic" | |
1033 | v.TopSurface,v.BottomSurface,v.FrontSurface,v.BackSurface,v.LeftSurface,v.RightSurface = 10,10,10,10,10,10 | |
1034 | end | |
1035 | end | |
1036 | ||
1037 | do | |
1038 | if modelScale ~= 1 then | |
1039 | for i,v in pairs(c0) do | |
1040 | c0[i] = (v-v.p) + v.p*modelScale | |
1041 | end | |
1042 | for i,v in pairs(c1) do | |
1043 | c1[i] = (v-v.p) + v.p*modelScale | |
1044 | end | |
1045 | local Joints = {} | |
1046 | local gtJoints,gtParts; | |
1047 | ||
1048 | local function gtCFrame(cf) | |
1049 | return (cf-cf.p) + cf.p * modelScale | |
1050 | end | |
1051 | ||
1052 | function gtJoints(p) | |
1053 | for i,v in pairs(p:GetChildren()) do | |
1054 | if v:IsA("JointInstance") then | |
1055 | table.insert(Joints,{v,v.Part0,v.Part1}) | |
1056 | v.Part0 = nil | |
1057 | v.Part1 = nil | |
1058 | v.C0 = (v.C0-(v.C0.p)) + (v.C0.p * modelScale) | |
1059 | v.C1 = (v.C1-(v.C1.p)) + (v.C1.p * modelScale) | |
1060 | end | |
1061 | gtJoints(v) | |
1062 | end | |
1063 | end | |
1064 | ||
1065 | function gtParts(p) | |
1066 | for i,v in pairs(p:GetChildren()) do | |
1067 | if v:IsA("BasePart") then | |
1068 | pcall(function() v.FormFactor = "Custom" end) | |
1069 | local oldz = v.Size | |
1070 | local cf = tor.CFrame:toObjectSpace(v.CFrame) | |
1071 | v.Size = v.Size * modelScale | |
1072 | v.CFrame = tor.CFrame * gtCFrame(cf) | |
1073 | local mesh = nil | |
1074 | for i,t in pairs(v:GetChildren()) do | |
1075 | if t:IsA("DataModelMesh") then | |
1076 | mesh = t | |
1077 | end | |
1078 | end | |
1079 | if mesh == nil and v:IsA("Part") and v.Shape == Enum.PartType.Ball then | |
1080 | mesh = Instance.new("SpecialMesh",v) | |
1081 | mesh.MeshType = Enum.MeshType.Sphere | |
1082 | end | |
1083 | if mesh == nil and ((v:IsA("Part") and v.Shape == Enum.PartType.Block) or v:IsA("Seat") or v:IsA("VehicleSeat")) then | |
1084 | mesh = Instance.new("BlockMesh",v) | |
1085 | end | |
1086 | if mesh ~= nil then | |
1087 | if mesh:IsA("SpecialMesh") and mesh.MeshType == Enum.MeshType.FileMesh then | |
1088 | mesh.Scale = mesh.Scale * modelScale | |
1089 | else | |
1090 | mesh.Scale = mesh.Scale*(oldz*modelScale)/v.Size | |
1091 | end | |
1092 | end | |
1093 | end | |
1094 | gtParts(v) | |
1095 | end | |
1096 | end | |
1097 | gtJoints(char) | |
1098 | gtParts(char) | |
1099 | for i,v in pairs(Joints) do | |
1100 | v[1].Part0 = v[2] | |
1101 | v[1].Part1 = v[3] | |
1102 | end | |
1103 | end | |
1104 | end | |
1105 | rs.C0,rs.C1 = c0.rs,c1.rs | |
1106 | ls.C0,ls.C1 = c0.ls,c1.ls | |
1107 | rh.C0,rh.C1 = c0.rh,c1.rh | |
1108 | lh.C0,lh.C1 = c0.lh,c1.lh | |
1109 | nk.C0,nk.C1 = c0.nk,c1.nk | |
1110 | tw.C0,tw.C1 = c0.tw,c1.tw | |
1111 | ||
1112 | local w10,w20 = w1.C0,w2.C0 | |
1113 | ||
1114 | local pl = tor:FindFirstChild("FairyLight") or Instance.new("PointLight",tor) | |
1115 | pl.Name = "FairyLight" | |
1116 | pl.Shadows = false | |
1117 | pl.Range = 8 | |
1118 | pl.Brightness = 10 | |
1119 | ||
1120 | local sparkles = tor:FindFirstChild("FairySparkles") or Instance.new("Sparkles",tor) | |
1121 | sparkles.Name = "FairySparkles" | |
1122 | ||
1123 | ||
1124 | local outfit = 0 | |
1125 | local outfitparts = {ra,la,rl,ll,tor} | |
1126 | local outfits = { | |
1127 | {{106705109},{106705077},{106703301},{106703213},{106705037}} | |
1128 | } | |
1129 | ||
1130 | ||
1131 | local mycolor = ll.BrickColor.Color | |
1132 | local mycolor2 = mycolor | |
1133 | ||
1134 | function setOutfit() | |
1135 | local of = outfits[outfit] | |
1136 | if of then | |
1137 | for i,v in pairs(outfitparts) do | |
1138 | local mesh = v:FindFirstChild("outfitMesh") | |
1139 | local meshdata = outfits[outfit][i] | |
1140 | if not mesh then | |
1141 | mesh = Instance.new("SpecialMesh",v) | |
1142 | mesh.Name = "outfitMesh" | |
1143 | mesh.TextureId = "rbxassetid://9854798" | |
1144 | end | |
1145 | mesh.Scale =(meshdata[2] or Vector3.new(1,1,1)) * modelScale | |
1146 | mesh.MeshId = "rbxassetid://"..meshdata[1] | |
1147 | mesh.VertexColor = Vector3.new(mycolor2.r,mycolor2.g,mycolor2.b) | |
1148 | end | |
1149 | else | |
1150 | for i,v in pairs(outfitparts) do | |
1151 | pcall(function() v.outfitMesh:Destroy() end) | |
1152 | end | |
1153 | end | |
1154 | end | |
1155 | setOutfit() | |
1156 | ||
1157 | local senabled = true | |
1158 | local lenabled = true | |
1159 | function changeColor() | |
1160 | for i,v in pairs(char:GetChildren()) do | |
1161 | if v:IsA("BasePart") then | |
1162 | v.BrickColor = BrickColor.new(mycolor) | |
1163 | end | |
1164 | end | |
1165 | local mc1 = Vector3.new(mycolor.r,mycolor.g,mycolor.b) | |
1166 | local mc2 = Vector3.new(mycolor2.r,mycolor2.g,mycolor2.b) | |
1167 | w1m.VertexColor,w2m.VertexColor,hm.VertexColor = mc1,mc1,mc2 | |
1168 | for i,v in pairs(outfitparts) do | |
1169 | local mesh = v:FindFirstChild("outfitMesh") | |
1170 | if mesh then | |
1171 | mesh.VertexColor = mc2 | |
1172 | end | |
1173 | end | |
1174 | pl.Color = mycolor | |
1175 | sparkles.SparkleColor = mycolor | |
1176 | end | |
1177 | changeColor() | |
1178 | ||
1179 | do | |
1180 | pcall(function() plr.PlayerGui.fairyColoring:Destroy() end) | |
1181 | local scr = Instance.new("ScreenGui",plr.PlayerGui) | |
1182 | scr.Name = "fairyColoring" | |
1183 | local fr = Instance.new("Frame",scr) | |
1184 | fr.Size = UDim2.new(0,-150,0,-65) | |
1185 | fr.BackgroundColor3 = Color3.new(1,1,1) | |
1186 | fr.BorderColor3 = Color3.new(.05,.05,.05) | |
1187 | fr.BackgroundTransparency = .8 | |
1188 | fr.Position = UDim2.new(1,0,1,scr.Parent:FindFirstChild("PandaHelpNotify") and -20 or 0) | |
1189 | fr.ZIndex = 9 | |
1190 | local am = 75 | |
1191 | local rval,gval,bval = mycolor.r,mycolor.g,mycolor.b | |
1192 | local r = Instance.new("TextButton",fr) | |
1193 | r.BackgroundTransparency = 1 | |
1194 | r.Size = UDim2.new(0,75,0,15) | |
1195 | r.Position = UDim2.new(0,5,0,5) | |
1196 | r.TextColor3 = Color3.new(1,1,1) | |
1197 | r.TextStrokeTransparency = .4 | |
1198 | for i=1,am do | |
1199 | local t = Instance.new("ImageLabel",r) | |
1200 | t.BorderSizePixel = 0 | |
1201 | t.Size = UDim2.new(1/am,0,1,0) | |
1202 | t.Position = UDim2.new((i-1)/am,0,0,0) | |
1203 | t.Name = i | |
1204 | t.ZIndex = 10 | |
1205 | end | |
1206 | local rb = Instance.new("ImageLabel",r) | |
1207 | rb.ZIndex = 10 | |
1208 | rb.Size = UDim2.new(0,2,1,-2) | |
1209 | rb.BackgroundColor3 = Color3.new(0,0,0) | |
1210 | rb.BackgroundTransparency = .5 | |
1211 | rb.BorderColor3 = Color3.new(.4,.4,.4) | |
1212 | rb.Name = "b" | |
1213 | local g = r:Clone() | |
1214 | g.Parent = fr | |
1215 | g.Position = UDim2.new(0,5,0,25) | |
1216 | local b = r:Clone() | |
1217 | b.Parent = fr | |
1218 | b.Position = UDim2.new(0,5,0,45) | |
1219 | r.ZIndex,g.ZIndex,b.ZIndex = 10,10,10 | |
1220 | local prev = Instance.new("TextButton",fr) | |
1221 | prev.Size = UDim2.new(0,55,0,45) | |
1222 | prev.Position = UDim2.new(0,90,0,5) | |
1223 | prev.ZIndex = 10 | |
1224 | prev.BorderColor3 = Color3.new(.2,.2,.2) | |
1225 | prev.TextColor3 = Color3.new(1,1,1) | |
1226 | prev.TextStrokeTransparency = .4 | |
1227 | prev.TextYAlignment = "Bottom" | |
1228 | prev.FontSize = "Size8" | |
1229 | prev.TextWrapped = true | |
1230 | local res = Instance.new("TextButton",fr) | |
1231 | res.Size = UDim2.new(0,55,0,9) | |
1232 | res.Position = UDim2.new(0,90,0,51) | |
1233 | res.ZIndex = 10 | |
1234 | res.BorderColor3 = Color3.new(.2,.2,.2) | |
1235 | res.BackgroundColor3 = Color3.new(.5,0,0) | |
1236 | res.TextColor3 = Color3.new(1,1,1) | |
1237 | res.Text = "reset" | |
1238 | res.FontSize = "Size8" | |
1239 | local mode = 0 | |
1240 | local function update(set) | |
1241 | r.b.Position = UDim2.new(rval,-1,0,1) | |
1242 | g.b.Position = UDim2.new(gval,-1,0,1) | |
1243 | b.b.Position = UDim2.new(bval,-1,0,1) | |
1244 | local col = Color3.new(rval,gval,bval) | |
1245 | prev.BackgroundColor3 = mode == 1 and mycolor2 or mycolor | |
1246 | prev.Text = "" | |
1247 | r.Text = math.floor(rval*255+.5) | |
1248 | g.Text = math.floor(gval*255+.5) | |
1249 | b.Text = math.floor(bval*255+.5) | |
1250 | for i,v in pairs(r:GetChildren()) do | |
1251 | local n = tonumber(v.Name) | |
1252 | if n then | |
1253 | local sc = n/am | |
1254 | v.BackgroundColor3 = Color3.new(sc,gval,bval) | |
1255 | end | |
1256 | end | |
1257 | for i,v in pairs(g:GetChildren()) do | |
1258 | local n = tonumber(v.Name) | |
1259 | if n then | |
1260 | local sc = n/am | |
1261 | v.BackgroundColor3 = Color3.new(rval,sc,bval) | |
1262 | end | |
1263 | end | |
1264 | for i,v in pairs(b:GetChildren()) do | |
1265 | local n = tonumber(v.Name) | |
1266 | if n then | |
1267 | local sc = n/am | |
1268 | v.BackgroundColor3 = Color3.new(rval,gval,sc) | |
1269 | end | |
1270 | end | |
1271 | if set ~= false then | |
1272 | if mode == 0 then | |
1273 | mycolor = col | |
1274 | end | |
1275 | if mode == 1 then | |
1276 | mycolor2 = col | |
1277 | end | |
1278 | changeColor() | |
1279 | end | |
1280 | end | |
1281 | update() | |
1282 | local rd,gd,bd = false,false,false | |
1283 | r.MouseButton1Down:connect(function(x,y) rd = true rval = (x-r.AbsolutePosition.X)/r.AbsoluteSize.X update() end) | |
1284 | r.MouseButton1Up:connect(function() rd = false end) | |
1285 | r.MouseLeave:connect(function() rd = false end) | |
1286 | r.MouseMoved:connect(function(x,y) if not rd then return end rval = (x-r.AbsolutePosition.X)/r.AbsoluteSize.X update() end) | |
1287 | g.MouseButton1Down:connect(function(x,y) gd = true gval = (x-g.AbsolutePosition.X)/g.AbsoluteSize.X update() end) | |
1288 | g.MouseButton1Up:connect(function() gd = false end) | |
1289 | g.MouseLeave:connect(function() gd = false end) | |
1290 | g.MouseMoved:connect(function(x,y) if not gd then return end gval = (x-g.AbsolutePosition.X)/g.AbsoluteSize.X update() end) | |
1291 | b.MouseButton1Down:connect(function(x,y) bd = true bval = (x-b.AbsolutePosition.X)/b.AbsoluteSize.X update() end) | |
1292 | b.MouseButton1Up:connect(function() bd = false end) | |
1293 | b.MouseLeave:connect(function() bd = false end) | |
1294 | b.MouseMoved:connect(function(x,y) if not bd then return end bval = (x-b.AbsolutePosition.X)/b.AbsoluteSize.X update() end) | |
1295 | res.MouseButton1Click:connect(function() | |
1296 | rval,gval,bval = themeColor.Color.r,themeColor.Color.g,themeColor.Color.b | |
1297 | update() | |
1298 | end) | |
1299 | ||
1300 | local modebtn = Instance.new("TextButton",fr) | |
1301 | modebtn.Position = UDim2.new(1,-150,0,-15) | |
1302 | modebtn.Size = UDim2.new(0,49,0,14) | |
1303 | modebtn.BackgroundColor3 = Color3.new(1,1,0) | |
1304 | modebtn.BackgroundTransparency = .6 | |
1305 | modebtn.TextScaled = true | |
1306 | modebtn.Font = 4 | |
1307 | modebtn.TextColor3 = Color3.new(1,1,1) | |
1308 | modebtn.TextStrokeTransparency = .7 | |
1309 | modebtn.Text = "Body" | |
1310 | modebtn.MouseButton1Click:connect(function() | |
1311 | mode = (mode+1)%2 | |
1312 | local col = mode == 1 and mycolor2 or mycolor | |
1313 | rval,gval,bval = col.r,col.g,col.b | |
1314 | modebtn.Text = mode == 0 and "Body" or "Clothes" | |
1315 | update(false) | |
1316 | end) | |
1317 | ||
1318 | local outfitbtn = Instance.new("TextButton",fr) | |
1319 | outfitbtn.Position = UDim2.new(1,-150,0,-30) | |
1320 | outfitbtn.Size = UDim2.new(0,49,0,14) | |
1321 | outfitbtn.BackgroundColor3 = Color3.new(1,1,0) | |
1322 | outfitbtn.BackgroundTransparency = .6 | |
1323 | outfitbtn.TextScaled = true | |
1324 | outfitbtn.Font = 4 | |
1325 | outfitbtn.TextColor3 = Color3.new(1,1,1) | |
1326 | outfitbtn.TextStrokeTransparency = .7 | |
1327 | outfitbtn.Text = "Outfit" | |
1328 | outfitbtn.MouseButton1Click:connect(function() | |
1329 | outfit = (outfit+1)%(#outfits+1) | |
1330 | setOutfit() | |
1331 | end) | |
1332 | ||
1333 | local sparklebtn = Instance.new("TextButton",fr) | |
1334 | sparklebtn.Position = UDim2.new(1,-100,0,-15) | |
1335 | sparklebtn.Size = UDim2.new(0,100,0,14) | |
1336 | sparklebtn.BackgroundColor3 = Color3.new(0,1,0) | |
1337 | sparklebtn.BackgroundTransparency = .6 | |
1338 | sparklebtn.TextScaled = true | |
1339 | sparklebtn.Font = 4 | |
1340 | sparklebtn.TextColor3 = Color3.new(1,1,1) | |
1341 | sparklebtn.TextStrokeTransparency = .7 | |
1342 | sparklebtn.Text = "Sparkles" | |
1343 | sparklebtn.MouseButton1Click:connect(function() | |
1344 | senabled = not senabled | |
1345 | sparklebtn.BackgroundColor3 = senabled and Color3.new(0,1,0) or Color3.new(1,0,0) | |
1346 | end) | |
1347 | local lightbtn = Instance.new("TextButton",fr) | |
1348 | lightbtn.Position = UDim2.new(1,-100,0,-30) | |
1349 | lightbtn.Size = UDim2.new(0,100,0,14) | |
1350 | lightbtn.BackgroundColor3 = Color3.new(0,1,0) | |
1351 | lightbtn.BackgroundTransparency = .6 | |
1352 | lightbtn.TextScaled = true | |
1353 | lightbtn.Font = 4 | |
1354 | lightbtn.TextColor3 = Color3.new(1,1,1) | |
1355 | lightbtn.TextStrokeTransparency = .7 | |
1356 | lightbtn.Text = "Light" | |
1357 | lightbtn.MouseButton1Click:connect(function() | |
1358 | lenabled = not lenabled | |
1359 | lightbtn.BackgroundColor3 = lenabled and Color3.new(0,1,0) or Color3.new(1,0,0) | |
1360 | end) | |
1361 | end | |
1362 | ||
1363 | ||
1364 | local gyro = root:FindFirstChild("RootGyro") or Instance.new("BodyGyro",root) | |
1365 | gyro.maxTorque = Vector3.new() | |
1366 | gyro.Name = "RootGyro" | |
1367 | ||
1368 | local vel = root:FindFirstChild("RootVel") or Instance.new("BodyVelocity",root) | |
1369 | vel.maxForce = Vector3.new() | |
1370 | vel.Name = "RootVel" | |
1371 | vel.P = 4000 | |
1372 | ||
1373 | local flying = false | |
1374 | local state = "idle" | |
1375 | local kd = {} | |
1376 | local humspd = 0 | |
1377 | local flyspeed = 0 | |
1378 | local flystop = 0 | |
1379 | local sitting = false | |
1380 | local holding = false | |
1381 | ||
1382 | m.KeyDown:connect(function(k) | |
1383 | local now = tick() | |
1384 | kd[k] = now | |
1385 | if k == " " and not flying then | |
1386 | pcall(function() sitting:Destroy() end) | |
1387 | sitting = nil | |
1388 | state = "fly" | |
1389 | flying = true | |
1390 | flydir = (root.CFrame.lookVector*Vector3.new(1,0,1)).unit | |
1391 | elseif k == " " and state == "fly" then | |
1392 | flying = false | |
1393 | state = "idle" | |
1394 | flystop = tick() | |
1395 | elseif k == "x" and m.Target and (root.Position-m.Hit.p).magnitude < 20*modelScale then | |
1396 | local tar = m.Target | |
1397 | local cf = tar.CFrame:toObjectSpace(m.Hit) | |
1398 | local siz = tar.Size/2 | |
1399 | local cfr | |
1400 | local rx,ry,rz = 0,0,0 | |
1401 | local lv = tar.CFrame:vectorToObjectSpace(root.CFrame.lookVector) | |
1402 | if math.abs(cf.Y-siz.Y) < .03 then | |
1403 | cfr = CFrame.new(cf.p + Vector3.new(0,3*modelScale,0)) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0) | |
1404 | elseif math.abs(-cf.Y-siz.Y) < .03 then | |
1405 | cfr = CFrame.new(cf.p - Vector3.new(0,3*modelScale,0)) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),math.pi) | |
1406 | elseif math.abs(cf.X-siz.X) < .03 then | |
1407 | cfr = CFrame.new(cf.p + Vector3.new(3*modelScale,0,0)) * CFrame.Angles(0,0,-math.pi/2) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0) | |
1408 | elseif math.abs(-cf.X-siz.X) < .03 then | |
1409 | cfr = CFrame.new(cf.p - Vector3.new(3*modelScale,0,0)) * CFrame.Angles(0,0,math.pi/2) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0) | |
1410 | elseif math.abs(cf.Z-siz.Z) < .03 then | |
1411 | cfr = CFrame.new(cf.p + Vector3.new(0,0,3*modelScale)) * CFrame.Angles(math.pi/2,0,0) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0) | |
1412 | elseif math.abs(-cf.Z-siz.Z) < .03 then | |
1413 | cfr = CFrame.new(cf.p - Vector3.new(0,0,3*modelScale)) * CFrame.Angles(-math.pi/2,0,0) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0) | |
1414 | end | |
1415 | if cfr then | |
1416 | pcall(function() sitting:Destroy() end) | |
1417 | flying = false | |
1418 | state = "sit" | |
1419 | if m.Target.Anchored then | |
1420 | sitting = {tar = tar, cf = cfr} | |
1421 | else | |
1422 | sitting = weld(tar,root,cfr) | |
1423 | end | |
1424 | end | |
1425 | end | |
1426 | end) | |
1427 | m.KeyUp:connect(function(k) | |
1428 | kd[k] = nil | |
1429 | end) | |
1430 | ||
1431 | hum.Running:connect(function(spd) | |
1432 | if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end | |
1433 | humspd = spd | |
1434 | state = flying and "fly" or (spd < 1 and "idle" or "walk") | |
1435 | end) | |
1436 | hum.Climbing:connect(function(spd) | |
1437 | if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end | |
1438 | humspd = spd | |
1439 | state = flying and "fly" or (spd < 1 and "idle" or "walk") | |
1440 | end) | |
1441 | hum.Seated:connect(function(a) | |
1442 | state = a and "sit" or humspd > 0 and "idle" or "walk" | |
1443 | end) | |
1444 | ||
1445 | hum.Changed:connect(function() | |
1446 | if hum.Jump then | |
1447 | hum.Jump = false | |
1448 | end | |
1449 | end) | |
1450 | ||
1451 | hum.FreeFalling:connect(function() | |
1452 | if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end | |
1453 | state = math.abs(tor.Velocity.Y) > 1 and "inair" or state | |
1454 | end) | |
1455 | ||
1456 | hum.FallingDown:connect(function(a) | |
1457 | if not a then return end | |
1458 | state = "inair" | |
1459 | end) | |
1460 | ||
1461 | ||
1462 | ||
1463 | while true do | |
1464 | runservice.RenderStepped:wait() | |
1465 | local cam = workspace.CurrentCamera | |
1466 | local alpha = .2 | |
1467 | sparkles.Enabled = senabled and flying and tor.Velocity.magnitude > 3 | |
1468 | pl.Enabled = lenabled | |
1469 | if state ~= "fly" then | |
1470 | if type(sitting) == "table" then | |
1471 | gyro.maxTorque = Vector3.new(1,1,1)*4e6 | |
1472 | vel.maxForce = Vector3.new(1,1,1)*4e5 | |
1473 | gyro.cframe = sitting.tar.CFrame * sitting.cf | |
1474 | vel.velocity = (gyro.cframe.p-root.Position)*10 | |
1475 | else | |
1476 | gyro.maxTorque,vel.maxForce = Vector3.new(),Vector3.new() | |
1477 | end | |
1478 | end | |
1479 | if sitting then | |
1480 | state = "sit" | |
1481 | end | |
1482 | tw.MaxVelocity,rh.MaxVelocity,lh.MaxVelocity,rs.MaxVelocity,ls.MaxVelocity,nk.MaxVelocity = 0,0,0,0,0,0 | |
1483 | tw.CurrentAngle,rh.CurrentAngle,lh.CurrentAngle,rs.CurrentAngle,ls.CurrentAngle,nk.CurrentAngle = 0,0,0,0,0,0 | |
1484 | ||
1485 | local hasRobe = outfit == 1 | |
1486 | ||
1487 | if state == "idle" then | |
1488 | hum.PlatformStand = false | |
1489 | local breathing = math.sin(tick()*2) | |
1490 | local tilt = .02 + breathing*.03 | |
1491 | w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha) | |
1492 | w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha) | |
1493 | ||
1494 | tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha) | |
1495 | rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt,hasRobe and 0 or -.1,hasRobe and 0 or .06),alpha) | |
1496 | lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt,hasRobe and 0 or .1,hasRobe and 0 or -.06),alpha) | |
1497 | rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt,0,.1),alpha) | |
1498 | ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt,0,-.1),alpha) | |
1499 | nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.05-.03,0,0),alpha) | |
1500 | elseif state == "inair" then | |
1501 | hum.PlatformStand = false | |
1502 | local wings = math.sin(tick()*80) | |
1503 | w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.15+wings*.3,0),.6) | |
1504 | w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.15-wings*.3,0),.6) | |
1505 | local alpha = .15 | |
1506 | local tilt = .05 | |
1507 | local wavey = math.sin(tick()*3) | |
1508 | tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha) | |
1509 | rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+wavey*.1,0,hasRobe and 0 or .02),alpha) | |
1510 | lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt-wavey*.1,0,hasRobe and 0 or -.02),alpha) | |
1511 | rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt-wavey*.07,0,.01),alpha) | |
1512 | ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+wavey*.07,0,-.01),alpha) | |
1513 | nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+.2,0,0),alpha) | |
1514 | elseif state == "walk" then | |
1515 | hum.PlatformStand = false | |
1516 | local walking = math.sin(tick()*25) | |
1517 | local breathing = math.sin(tick()*2) | |
1518 | local tilt = -.03-breathing*.02+walking*.01 | |
1519 | alpha = .6 | |
1520 | w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.05+breathing*.01+walking*.05,0),alpha) | |
1521 | w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.05-breathing*.01+walking*.05,0),alpha) | |
1522 | ||
1523 | tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,-walking*.08,0),alpha) | |
1524 | rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+walking*.3,0,hasRobe and 0 or .02),alpha) | |
1525 | lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt-walking*.3,0,hasRobe and 0 or -.02),alpha) | |
1526 | rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt+.05-walking*.25,0,.01),alpha) | |
1527 | ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+.05+walking*.25,0,-.01),alpha) | |
1528 | nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.04,walking*.07,0),alpha) | |
1529 | elseif state == "sit" then | |
1530 | hum.Sit = false | |
1531 | hum.PlatformStand = true | |
1532 | local breathing = math.sin(tick()*2) | |
1533 | local upvec = root.CFrame:vectorToWorldSpace(Vector3.new(0,1,0)) | |
1534 | if upvec.Y > .4 then | |
1535 | local tilt = -.55+breathing*.015 | |
1536 | w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha) | |
1537 | w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha) | |
1538 | tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0)+Vector3.new(0,-1.7,0)*modelScale,alpha) | |
1539 | rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+1.57,0,hasRobe and 0 or .6),alpha) | |
1540 | lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt+1.57,0,hasRobe and 0 or -.6),alpha) | |
1541 | rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt+.3,0,-.1)*CFrame.Angles(hasRobe and .3 or 0,hasRobe and .2 or 0,hasRobe and -.2 or 0)+(hasRobe and 0 or 1)*Vector3.new(-.85,-.25,-.25)*modelScale,alpha) | |
1542 | ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+.3,0,.1)*CFrame.Angles(hasRobe and .3 or 0,hasRobe and -.2 or 0,hasRobe and .2 or 0)+(hasRobe and 0 or 1)*Vector3.new(.85,-.25,-.25)*modelScale,alpha) | |
1543 | nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.04-.03,0,math.sin(tick()*4)*.06),alpha) | |
1544 | else -- wallhug | |
1545 | local breathing = math.sin(tick()*5) | |
1546 | local tilt = -1.55+breathing*.015 | |
1547 | w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha) | |
1548 | w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha) | |
1549 | tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0)+Vector3.new(0,-2.5,0)*modelScale,alpha) | |
1550 | rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(.2,0,hasRobe and 0 or .5)+Vector3.new(0,hasRobe and 0 or .2,0)*modelScale,alpha) | |
1551 | lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(.2,0,hasRobe and 0 or -.5)+Vector3.new(0,hasRobe and 0 or .2,0)*modelScale,alpha) | |
1552 | rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(2.9,0,.8)+Vector3.new(-.2,.4,0)*modelScale,alpha) | |
1553 | ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(2.9,0,-.8)+Vector3.new(.2,.4,0)*modelScale,alpha) | |
1554 | nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(breathing*.04+.7,0,0),alpha) | |
1555 | end | |
1556 | elseif state == "fly" then | |
1557 | hum.PlatformStand = true | |
1558 | gyro.maxTorque = Vector3.new(1,1,1)*4e6 | |
1559 | vel.maxForce = Vector3.new(1,1,1)*4e5 | |
1560 | ||
1561 | local velocity = Vector3.new((kd.d and 1 or 0)+(kd.a and -1 or 0),0,(kd.s and 1 or 0)+(kd.w and -1 or 0)) | |
1562 | velocity = cam.CoordinateFrame:vectorToWorldSpace(velocity) | |
1563 | local maxspeed = 40-(velocity.magnitude > 0 and velocity.unit.Y*20 or 0) | |
1564 | if velocity.magnitude > 0 then | |
1565 | flyspeed = lerp(flyspeed,maxspeed,.1) | |
1566 | flydir = flydir:Lerp(velocity.unit,.4).unit | |
1567 | hoverheight = nil | |
1568 | else | |
1569 | flyspeed = lerp(flyspeed,0,.3) | |
1570 | flydir = (flydir*Vector3.new(1,0,1)).unit | |
1571 | hoverheight = hoverheight or root.Position.Y | |
1572 | end | |
1573 | vel.velocity = flydir.unit * flyspeed | |
1574 | if hoverheight then | |
1575 | vel.velocity = vel.velocity + Vector3.new(0,hoverheight-root.Position.Y,0) | |
1576 | end | |
1577 | gyro.cframe = CFrame.new(Vector3.new(),flydir*Vector3.new(1,0,1)) | |
1578 | ||
1579 | rl.CanCollide,ll.CanCollide = true,true | |
1580 | ||
1581 | local wings = math.sin(tick()*80) | |
1582 | w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.15+wings*.3,0),.6) | |
1583 | w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.15-wings*.3,0),.6) | |
1584 | local alpha = .15 | |
1585 | local flytilt = (flyspeed/maxspeed) | |
1586 | local tilt = flytilt*-1.4 + math.asin(gyro.cframe:vectorToObjectSpace(flydir).unit.Y) | |
1587 | local wavey = math.sin(tick()*6) | |
1588 | tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha) | |
1589 | rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(wavey*.1,hasRobe and 0 or -.08,hasRobe and 0 or .1),alpha) | |
1590 | lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-wavey*.1,hasRobe and 0 or .08,hasRobe and 0 or -.1),alpha) | |
1591 | rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-wavey*.15,-.08,.1),alpha) | |
1592 | ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(wavey*.15,.08,-.1),alpha) | |
1593 | nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt*.8,0,0),alpha) | |
1594 | end | |
1595 | end |