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