SHOW:
|
|
- or go back to the newest paste.
1 | --https://github.com/Mokiros/roblox-FE-compatibility | |
2 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
3 | local Player,game,owner = owner,game | |
4 | local RealPlayer = Player | |
5 | do | |
6 | print("FE Compatibility code V2 by Mokiros") | |
7 | local RealPlayer = RealPlayer | |
8 | script.Parent = RealPlayer.Character | |
9 | ||
10 | --Fake event to make stuff like Mouse.KeyDown work | |
11 | local Disconnect_Function = function(this) | |
12 | this[1].Functions[this[2]] = nil | |
13 | end | |
14 | local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}} | |
15 | local FakeEvent_Metatable = {__index={ | |
16 | Connect = function(this,f) | |
17 | local i = tostring(math.random(0,10000)) | |
18 | while this.Functions[i] do | |
19 | i = tostring(math.random(0,10000)) | |
20 | end | |
21 | this.Functions[i] = f | |
22 | return setmetatable({this,i},Disconnect_Metatable) | |
23 | end | |
24 | }} | |
25 | FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect | |
26 | local function fakeEvent() | |
27 | return setmetatable({Functions={}},FakeEvent_Metatable) | |
28 | end | |
29 | ||
30 | --Creating fake input objects with fake variables | |
31 | local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()} | |
32 | FakeMouse.keyUp = FakeMouse.KeyUp | |
33 | FakeMouse.keyDown = FakeMouse.KeyDown | |
34 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} | |
35 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) | |
36 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil | |
37 | end} | |
38 | --Merged 2 functions into one by checking amount of arguments | |
39 | CAS.UnbindAction = CAS.BindAction | |
40 | ||
41 | --This function will trigger the events that have been :Connect()'ed | |
42 | local function TriggerEvent(self,ev,...) | |
43 | for _,f in pairs(self[ev].Functions) do | |
44 | f(...) | |
45 | end | |
46 | end | |
47 | FakeMouse.TriggerEvent = TriggerEvent | |
48 | UIS.TriggerEvent = TriggerEvent | |
49 | ||
50 | --Client communication | |
51 | local Event = Instance.new("RemoteEvent") | |
52 | Event.Name = "UserInput_Event" | |
53 | Event.OnServerEvent:Connect(function(plr,io) | |
54 | if plr~=RealPlayer then return end | |
55 | FakeMouse.Target = io.Target | |
56 | FakeMouse.Hit = io.Hit | |
57 | if not io.isMouse then | |
58 | local b = io.UserInputState == Enum.UserInputState.Begin | |
59 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
60 | return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up") | |
61 | end | |
62 | if io.UserInputType == Enum.UserInputType.MouseButton2 then | |
63 | return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up") | |
64 | end | |
65 | for _,t in pairs(CAS.Actions) do | |
66 | for _,k in pairs(t.Keys) do | |
67 | if k==io.KeyCode then | |
68 | t.Function(t.Name,io.UserInputState,io) | |
69 | end | |
70 | end | |
71 | end | |
72 | FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
73 | UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false) | |
74 | end | |
75 | end) | |
76 | Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event") | |
77 | local Mouse = owner:GetMouse() | |
78 | local UIS = game:GetService("UserInputService") | |
79 | local input = function(io,RobloxHandled) | |
80 | if RobloxHandled then return end | |
81 | --Since InputObject is a client-side instance, we create and pass table instead | |
82 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target}) | |
83 | end | |
84 | UIS.InputBegan:Connect(input) | |
85 | UIS.InputEnded:Connect(input) | |
86 | ||
87 | local h,t | |
88 | --Give the server mouse data every second frame, but only if the values changed | |
89 | --If player is not moving their mouse, client won't fire events | |
90 | local HB = game:GetService("RunService").Heartbeat | |
91 | while true do | |
92 | if h~=Mouse.Hit or t~=Mouse.Target then | |
93 | h,t=Mouse.Hit,Mouse.Target | |
94 | Event:FireServer({isMouse=true,Target=t,Hit=h}) | |
95 | end | |
96 | --Wait 2 frames | |
97 | for i=1,2 do | |
98 | HB:Wait() | |
99 | end | |
100 | end]==],script) | |
101 | ||
102 | ----Sandboxed game object that allows the usage of client-side methods and services | |
103 | --Real game object | |
104 | local RealGame = game | |
105 | ||
106 | --Metatable for fake service | |
107 | local FakeService_Metatable = { | |
108 | __index = function(self,k) | |
109 | local s = rawget(self,"_RealService") | |
110 | if s then | |
111 | return typeof(s[k])=="function" | |
112 | and function(_,...)return s[k](s,...)end or s[k] | |
113 | end | |
114 | end, | |
115 | __newindex = function(self,k,v) | |
116 | local s = rawget(self,"_RealService") | |
117 | if s then s[k]=v end | |
118 | end | |
119 | } | |
120 | local function FakeService(t,RealService) | |
121 | t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService | |
122 | return setmetatable(t,FakeService_Metatable) | |
123 | end | |
124 | ||
125 | --Fake game object | |
126 | local FakeGame = { | |
127 | GetService = function(self,s) | |
128 | return rawget(self,s) or RealGame:GetService(s) | |
129 | end, | |
130 | Players = FakeService({ | |
131 | LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player) | |
132 | },"Players"), | |
133 | UserInputService = FakeService(UIS,"UserInputService"), | |
134 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
135 | RunService = FakeService({ | |
136 | _btrs = {}, | |
137 | RenderStepped = RealGame:GetService("RunService").Heartbeat, | |
138 | BindToRenderStep = function(self,name,_,fun) | |
139 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
140 | end, | |
141 | UnbindFromRenderStep = function(self,name) | |
142 | self._btrs[name]:Disconnect() | |
143 | end, | |
144 | },"RunService") | |
145 | } | |
146 | rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer) | |
147 | FakeGame.service = FakeGame.GetService | |
148 | FakeService(FakeGame,game) | |
149 | --Changing owner to fake player object to support owner:GetMouse() | |
150 | game,owner = FakeGame,FakeGame.Players.LocalPlayer | |
151 | end | |
152 | print([[ | |
153 | ___________________________________ | |
154 | ||
155 | Booty Offender // A Kyutatsuki13's script | |
156 | Build 0001 | |
157 | Credit to Ethanhong that gave me this idea ;) | |
158 | https://discord.gg/DueqyJ8 | |
159 | ||
160 | ___________________________________ | |
161 | ]]) | |
162 | ||
163 | warn("You're whitelisted, "..game:GetService("Players").LocalPlayer.Name.." :)") | |
164 | ||
165 | local p = game:GetService("Players").LocalPlayer | |
166 | local char = p.Character | |
167 | local mouse = p:GetMouse() | |
168 | local larm = char:WaitForChild("Left Arm") | |
169 | local rarm = char:WaitForChild("Right Arm") | |
170 | local lleg = char:WaitForChild("Left Leg") | |
171 | local rleg = char:WaitForChild("Right Leg") | |
172 | local hed = char:WaitForChild("Head") | |
173 | local torso = char:WaitForChild("Torso") | |
174 | local root = char:WaitForChild("HumanoidRootPart") | |
175 | local hum = char:FindFirstChildOfClass("Humanoid") | |
176 | local debris = game:GetService("Debris") | |
177 | local input = game:GetService("UserInputService") | |
178 | local run = game:GetService("RunService") | |
179 | local rs = run.RenderStepped | |
180 | local wingpose = "Idle" | |
181 | local DebrisModel = Instance.new("Model",char) | |
182 | DebrisModel.Name = "Debris" | |
183 | repeat rs:wait() until p.CharacterAppearanceLoaded | |
184 | ||
185 | noidle = false | |
186 | shift = false | |
187 | control = false | |
188 | ||
189 | ---------------------------------------------------------------------------- | |
190 | ||
191 | function rswait(value) | |
192 | if value ~= nil and value ~= 0 then | |
193 | for i=1,value do | |
194 | rs:wait() | |
195 | end | |
196 | else | |
197 | rs:wait() | |
198 | end | |
199 | end | |
200 | ||
201 | ---------------------------------------------------------------------------- | |
202 | ||
203 | local timeposition = 0 | |
204 | ||
205 | function music(id) | |
206 | if id == "Stop" then | |
207 | if not torso:FindFirstChild("MusicRuin") then | |
208 | soundz = Instance.new("Sound",torso) | |
209 | end | |
210 | soundz:Stop() | |
211 | else | |
212 | if not torso:FindFirstChild("MusicRuin") then | |
213 | soundz = Instance.new("Sound",torso) | |
214 | for i=1,2 do | |
215 | local equalizer = Instance.new("EqualizerSoundEffect",soundz) | |
216 | equalizer.HighGain = 6 | |
217 | equalizer.MidGain = 0 | |
218 | equalizer.LowGain = 6 | |
219 | end | |
220 | end | |
221 | soundz.Volume = 10 | |
222 | soundz.Name = "MusicRuin" | |
223 | soundz.Looped = true | |
224 | soundz.PlaybackSpeed = 1 | |
225 | soundz.SoundId = "rbxassetid://"..id | |
226 | soundz:Stop() | |
227 | soundz:Play() | |
228 | end | |
229 | end | |
230 | ||
231 | ---------------------------------------------------------------------------- | |
232 | ||
233 | function lerp(a, b, t) | |
234 | return a + (b - a)*t | |
235 | end | |
236 | ||
237 | ---------------------------------------------------------------------------- | |
238 | ||
239 | function Lerp(c1,c2,al) | |
240 | local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()} | |
241 | local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()} | |
242 | for i,v in pairs(com1) do | |
243 | com1[i] = v+(com2[i]-v)*al | |
244 | end | |
245 | return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1))) | |
246 | end | |
247 | ||
248 | ---------------------------------------------------------------------------- | |
249 | ||
250 | function slerp(a, b, t) | |
251 | dot = a:Dot(b) | |
252 | if dot > 0.99999 or dot < -0.99999 then | |
253 | return t <= 0.5 and a or b | |
254 | else | |
255 | r = math.acos(dot) | |
256 | return (a*math.sin((1 - t)*r) + b*math.sin(t*r)) / math.sin(r) | |
257 | end | |
258 | end | |
259 | ||
260 | ---------------------------------------------------------------------------- | |
261 | ||
262 | function clerp(c1,c2,al) | |
263 | ||
264 | local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()} | |
265 | ||
266 | local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()} | |
267 | ||
268 | for i,v in pairs(com1) do | |
269 | ||
270 | com1[i] = lerp(v,com2[i],al) | |
271 | ||
272 | end | |
273 | ||
274 | return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1))) | |
275 | ||
276 | end | |
277 | ||
278 | ---------------------------------------------------------------------------- | |
279 | ||
280 | function findAllNearestTorso(pos,dist) | |
281 | local list = workspace:children() | |
282 | local torso = {} | |
283 | local temp = nil | |
284 | local human = nil | |
285 | local temp2 = nil | |
286 | for x = 1, #list do | |
287 | temp2 = list[x] | |
288 | if (temp2.className == "Model") and (temp2 ~= char) then | |
289 | temp = temp2:findFirstChild("Torso") | |
290 | human = temp2:findFirstChildOfClass("Humanoid") | |
291 | if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then | |
292 | if (temp.Position - pos).magnitude < dist then | |
293 | table.insert(torso,temp) | |
294 | dist = (temp.Position - pos).magnitude | |
295 | end | |
296 | end | |
297 | end | |
298 | end | |
299 | return torso | |
300 | end | |
301 | ||
302 | ---------------------------------------------------------------------------- | |
303 | ||
304 | function checkIfNotPlayer(model) | |
305 | if model.CanCollide == true and model ~= char and model.Parent ~= char and model.Parent.Parent ~= char and model.Parent.Parent ~= char and model.Parent ~= DebrisModel and model.Parent.Parent ~= DebrisModel and model.Parent.Parent.Parent ~= DebrisModel and model ~= wings and model.Parent ~= wings and model.Parent.Parent ~= wings then | |
306 | return true | |
307 | else | |
308 | return false | |
309 | end | |
310 | end | |
311 | ||
312 | ---------------------------------------------------------------------------- | |
313 | ||
314 | function newWeld(wp0, wp1, wc0x, wc0y, wc0z) | |
315 | ||
316 | local wld = Instance.new("Weld", wp1) | |
317 | ||
318 | wld.Part0 = wp0 | |
319 | ||
320 | wld.Part1 = wp1 | |
321 | ||
322 | wld.C0 = CFrame.new(wc0x, wc0y, wc0z) | |
323 | ||
324 | return wld | |
325 | ||
326 | end | |
327 | ||
328 | function weld(model) | |
329 | local parts,last = {} | |
330 | local function scan(parent) | |
331 | for _,v in pairs(parent:GetChildren()) do | |
332 | if (v:IsA("BasePart")) then | |
333 | if (last) then | |
334 | local w = Instance.new("Weld") | |
335 | w.Name = ("%s_Weld"):format(v.Name) | |
336 | w.Part0,w.Part1 = last,v | |
337 | w.C0 = last.CFrame:inverse() | |
338 | w.C1 = v.CFrame:inverse() | |
339 | w.Parent = last | |
340 | end | |
341 | last = v | |
342 | table.insert(parts,v) | |
343 | end | |
344 | scan(v) | |
345 | end | |
346 | end | |
347 | scan(model) | |
348 | for _,v in pairs(parts) do | |
349 | v.Anchored = false | |
350 | v.Locked = true | |
351 | v.Anchored = false | |
352 | v.BackSurface = Enum.SurfaceType.SmoothNoOutlines | |
353 | v.BottomSurface = Enum.SurfaceType.SmoothNoOutlines | |
354 | v.FrontSurface = Enum.SurfaceType.SmoothNoOutlines | |
355 | v.LeftSurface = Enum.SurfaceType.SmoothNoOutlines | |
356 | v.RightSurface = Enum.SurfaceType.SmoothNoOutlines | |
357 | v.TopSurface = Enum.SurfaceType.SmoothNoOutlines | |
358 | v.CustomPhysicalProperties = PhysicalProperties.new(0,0,0) | |
359 | end | |
360 | end | |
361 | ||
362 | ---------------------------------------------------------------------------- | |
363 | ||
364 | function calculate(part,asd) | |
365 | local Head = hed | |
366 | local RightShoulder = asd | |
367 | local RightArm = part | |
368 | local MousePosition = mouse.Hit.p | |
369 | local ToMouse = (MousePosition - Head.Position).unit | |
370 | local Angle = math.acos(ToMouse:Dot(Vector3.new(0, 1, 0))) | |
371 | local FromRightArmPos = (Head.Position + Head.CFrame:vectorToWorldSpace(Vector3.new(((Head.Size.X / 2) + (RightArm.Size.X / 2)), ((Head.Size.Y / 2) - (RightArm.Size.Z / 2)), 0))) | |
372 | local ToMouseRightArm = ((MousePosition - FromRightArmPos) * Vector3.new(1 ,0, 1)).unit | |
373 | local Look = (Head.CFrame.lookVector * Vector3.new(1, 0, 1)).unit | |
374 | local LateralAngle = math.acos(ToMouseRightArm:Dot(Look)) | |
375 | if tostring(LateralAngle) == "-1.#IND" then | |
376 | LateralAngle = 0 | |
377 | end | |
378 | local Cross = Head.CFrame.lookVector:Cross(ToMouseRightArm) | |
379 | if LateralAngle > (math.pi / 2) then | |
380 | LateralAngle = (math.pi / 2) | |
381 | local Torso = root | |
382 | local Point = Torso.CFrame:vectorToObjectSpace(mouse.Hit.p-Torso.CFrame.p) | |
383 | if Point.Z > 0 then | |
384 | if Point.X > -0 and RightArm == rarm then | |
385 | Torso.CFrame = CFrame.new(Torso.Position,Vector3.new(mouse.Hit.X,Torso.Position.Y,mouse.Hit.Z))*CFrame.Angles(0,math.rad(110),0) | |
386 | elseif Point.X < 0 and RightArm == rarm then | |
387 | Torso.CFrame = CFrame.new(Torso.Position,Vector3.new(mouse.Hit.X,Torso.Position.Y,mouse.Hit.Z))*CFrame.Angles(0,math.rad(-110),0) | |
388 | end | |
389 | end | |
390 | end | |
391 | if Cross.Y < 0 then | |
392 | LateralAngle = -LateralAngle | |
393 | end | |
394 | return(CFrame.Angles(((math.pi / 2) - Angle), ((math.pi / 2) + LateralAngle), math.pi/2)) | |
395 | end | |
396 | ||
397 | ---------------------------------------------------------------------------- | |
398 | ||
399 | function sound(id,position,vol,pitch,start,finish) | |
400 | coroutine.resume(coroutine.create(function() | |
401 | ||
402 | local part = Instance.new("Part",workspace) | |
403 | part.Position = position | |
404 | part.Size = Vector3.new(0,0,0) | |
405 | part.CanCollide = false | |
406 | part.Transparency = 1 | |
407 | ||
408 | local sound = Instance.new("Sound",part) | |
409 | ||
410 | sound.SoundId = "rbxassetid://"..id | |
411 | ||
412 | repeat rs:wait() until sound.IsLoaded | |
413 | ||
414 | if vol ~= nil then | |
415 | sound.Volume = vol | |
416 | end | |
417 | ||
418 | if pitch ~= nil then | |
419 | sound.PlaybackSpeed = pitch | |
420 | end | |
421 | ||
422 | if start ~= nil then | |
423 | sound.TimePosition = start | |
424 | end | |
425 | ||
426 | if finish ~= nil then | |
427 | debris:AddItem(part,finish-start) | |
428 | else | |
429 | debris:AddItem(part,sound.TimeLength) | |
430 | end | |
431 | ||
432 | sound:Play() | |
433 | ||
434 | return sound | |
435 | ||
436 | end)) | |
437 | end | |
438 | ||
439 | ---------------------------------------------------------------------------- | |
440 | ||
441 | function computeDirection(vec) | |
442 | local lenSquared = vec.magnitude * vec.magnitude | |
443 | local invSqrt = 1 / math.sqrt(lenSquared) | |
444 | return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt) | |
445 | end | |
446 | ||
447 | ---------------------------------------------------------------------------- | |
448 | ||
449 | local shaking = 0 | |
450 | function shake(num) if num > shaking then shaking = num end end | |
451 | game:GetService("RunService").RenderStepped:connect(function() | |
452 | hum.CameraOffset = Vector3.new(math.random(-1,1),math.random(-1,1),math.random(-1,1))*(shaking/100) | |
453 | if shaking > 0 then shaking = shaking - 1 else shaking = 0 end | |
454 | end) | |
455 | ||
456 | plr = game:GetService("Players").LocalPlayer | |
457 | DebrisModel = Instance.new("Model",plr.Character) | |
458 | DebrisModel.Name = "DebrisModel" | |
459 | ||
460 | function Effect(mesh,size,transparency,material,color,position,rotation,positionchange,sizechange,rotationchange,transparencychange,acceleration) | |
461 | ||
462 | local part = Instance.new("Part",DebrisModel) | |
463 | part.Anchored = true | |
464 | part.CanCollide = false | |
465 | part.Size = Vector3.new(1,1,1) | |
466 | part.Transparency = transparency | |
467 | part.Material = material | |
468 | part.Color = color | |
469 | part.CFrame = CFrame.new(position)*CFrame.Angles(math.rad(rotation.X),math.rad(rotation.Y),math.rad(rotation.Z)) | |
470 | ||
471 | local partmesh = Instance.new("SpecialMesh",part) | |
472 | if tonumber(mesh) == nil then partmesh.MeshType = mesh else partmesh.MeshId = "rbxassetid://"..mesh end | |
473 | partmesh.Scale = size | |
474 | ||
475 | local pvalue = Instance.new("Vector3Value",part) | |
476 | pvalue.Name = "Position" | |
477 | pvalue.Value = positionchange | |
478 | ||
479 | local svalue = Instance.new("Vector3Value",part) | |
480 | svalue.Name = "Size" | |
481 | svalue.Value = sizechange | |
482 | ||
483 | local rvalue = Instance.new("Vector3Value",part) | |
484 | rvalue.Name = "Rotation" | |
485 | rvalue.Value = rotationchange | |
486 | ||
487 | local tvalue = Instance.new("NumberValue",part) | |
488 | tvalue.Name = "Transparency" | |
489 | tvalue.Value = transparencychange | |
490 | ||
491 | local avalue = Instance.new("NumberValue",part) | |
492 | avalue.Name = "Acceleration" | |
493 | avalue.Value = acceleration | |
494 | ||
495 | part.Name = "EFFECT" | |
496 | ||
497 | return part | |
498 | ||
499 | end | |
500 | ||
501 | game:GetService("RunService").RenderStepped:connect(function() | |
502 | coroutine.resume(coroutine.create(function() | |
503 | ||
504 | for i, v in pairs(DebrisModel:GetChildren()) do | |
505 | if v:isA("BasePart") then | |
506 | v.LocalTransparencyModifier = 0 | |
507 | end | |
508 | end | |
509 | ||
510 | if not plr.Character:FindFirstChild("DebrisModel") then | |
511 | DebrisModel = Instance.new("Model",plr.Character) | |
512 | DebrisModel.Name = "DebrisModel" | |
513 | end | |
514 | ||
515 | for i,v in pairs(DebrisModel:GetChildren()) do | |
516 | if v:IsA("BasePart") and v.Name == "EFFECT" then | |
517 | local pvalue = v:FindFirstChild("Position").Value | |
518 | local svalue = v:FindFirstChild("Size").Value | |
519 | local rvalue = v:FindFirstChild("Rotation").Value | |
520 | local tvalue = v:FindFirstChild("Transparency").Value | |
521 | local avalue = v:FindFirstChild("Acceleration").Value | |
522 | local mesh = v:FindFirstChild("Mesh") | |
523 | mesh.Scale = mesh.Scale + svalue | |
524 | v:FindFirstChild("Size").Value = v:FindFirstChild("Size").Value + (Vector3.new(1,1,1)*avalue) | |
525 | v.Transparency = v.Transparency + tvalue | |
526 | v.CFrame = CFrame.new(pvalue)*v.CFrame*CFrame.Angles(math.rad(rvalue.X),math.rad(rvalue.Y),math.rad(rvalue.Z)) | |
527 | if v.Transparency >= 1 or mesh.Scale.X < 0 or mesh.Scale.Y < 0 or mesh.Scale.Z < 0 then | |
528 | v:Destroy() | |
529 | end | |
530 | end | |
531 | end | |
532 | ||
533 | end)) | |
534 | end) | |
535 | ||
536 | local wsback = 0 | |
537 | local frozen = false | |
538 | function freeze() | |
539 | if frozen == false then | |
540 | frozen = true | |
541 | wsback = hum.WalkSpeed | |
542 | hum.WalkSpeed = 1 | |
543 | else | |
544 | frozen = false | |
545 | hum.WalkSpeed = wsback | |
546 | end | |
547 | end | |
548 | hum.WalkSpeed = 25 | |
549 | ||
550 | function Lightning(Part0,Part1,Times,Offset,Color,Thickness,Trans) | |
551 | local magz = (Part0 - Part1).magnitude | |
552 | local curpos = Part0 | |
553 | local trz = {-Offset,Offset} | |
554 | for i=1,Times do | |
555 | local li = Instance.new("Part", DebrisModel) | |
556 | li.TopSurface =0 | |
557 | li.Material = Enum.Material.Neon | |
558 | li.BottomSurface = 0 | |
559 | li.Anchored = true | |
560 | li.Locked = true | |
561 | li.Transparency = Trans or 0.4 | |
562 | li.Color = Color | |
563 | li.formFactor = "Custom" | |
564 | li.CanCollide = false | |
565 | li.Size = Vector3.new(Thickness,Thickness,magz/Times) | |
566 | local lim = Instance.new("BlockMesh",li) | |
567 | local Offzet = Vector3.new(trz[math.random(1,2)],trz[math.random(1,2)],trz[math.random(1,2)]) | |
568 | local trolpos = CFrame.new(curpos,Part1)*CFrame.new(0,0,magz/Times).p+Offzet | |
569 | if Times == i then | |
570 | local magz2 = (curpos - Part1).magnitude | |
571 | li.Size = Vector3.new(Thickness,Thickness,magz2) | |
572 | li.CFrame = CFrame.new(curpos,Part1)*CFrame.new(0,0,-magz2/2) | |
573 | else | |
574 | li.CFrame = CFrame.new(curpos,trolpos)*CFrame.new(0,0,magz/Times/2) | |
575 | end | |
576 | curpos = li.CFrame*CFrame.new(0,0,magz/Times/2).p | |
577 | li.Name = "LIGHTNING" | |
578 | end | |
579 | end | |
580 | ||
581 | ---------------------------------------------------------------------------- | |
582 | skin_color = BrickColor.new("Light orange") | |
583 | --p:ClearCharacterAppearance() | |
584 | --hed:WaitForChild("face"):Destroy() | |
585 | hed:WaitForChild("face").Texture = "rbxassetid://407320095" | |
586 | ---------------------------------------------------------------------------- | |
587 | local size = 1 | |
588 | ||
589 | newWeld(torso, larm, -1.5, 0.5, 0) | |
590 | larm.Weld.C1 = CFrame.new(0, 0.5, 0) | |
591 | newWeld(torso, rarm, 1.5, 0.5, 0) | |
592 | rarm.Weld.C1 = CFrame.new(0, 0.5, 0) | |
593 | newWeld(torso, hed, 0, 1.5, 0) | |
594 | newWeld(torso, lleg, -0.5, -1, 0) | |
595 | lleg.Weld.C1 = CFrame.new(0, 1, 0) | |
596 | newWeld(torso, rleg, 0.5, -1, 0) | |
597 | rleg.Weld.C1 = CFrame.new(0, 1, 0) | |
598 | newWeld(root, torso, 0, -1, 0) | |
599 | torso.Weld.C1 = CFrame.new(0, -1, 0) | |
600 | ||
601 | emitters={} | |
602 | ||
603 | ---------------------------------------------------------------------------------------- | |
604 | music(288494027) | |
605 | velocityYFall=0 | |
606 | velocityYFall2=0 | |
607 | velocityYFall3=0 | |
608 | velocityYFall4=0 | |
609 | neckrotY=0 | |
610 | neckrotY2=0 | |
611 | torsorotY=0 | |
612 | torsorotY2=0 | |
613 | torsoY=0 | |
614 | torsoY2=0 | |
615 | colored = 0 | |
616 | sine = 0 | |
617 | change=0.4 | |
618 | movement=10 | |
619 | timeranim=0 | |
620 | running = false | |
621 | jumped = false | |
622 | icolor=1 | |
623 | imode=false | |
624 | ||
625 | didjump = false | |
626 | jumppower = 0 | |
627 | debounceimpact = false | |
628 | ||
629 | function jumpimpact() | |
630 | if debounceimpact == false then | |
631 | debounceimpact = true | |
632 | if jumppower < -150 then jumppower = -150 end | |
633 | shake(-jumppower/5) | |
634 | for i=1,-jumppower/20 do rs:wait() | |
635 | hed.Weld.C1 = Lerp(hed.Weld.C1, CFrame.Angles(0,0,0), 0.05) | |
636 | torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, (jumppower/20)-hum.HipHeight, 0) * CFrame.Angles(math.rad(0),math.rad(0), math.rad(0)), 0.05) | |
637 | end | |
638 | debounceimpact = false | |
639 | end | |
640 | end | |
641 | ||
642 | max = 0 | |
643 | ||
644 | rs:connect(function() | |
645 | ||
646 | for i,v in pairs(DebrisModel:GetChildren()) do | |
647 | if v.Name == "LIGHTNING" then | |
648 | local vm = v:FindFirstChildOfClass("BlockMesh") | |
649 | vm.Scale = vm.Scale - Vector3.new(0.1,0.1,0) | |
650 | if vm.Scale.X <= 0 then | |
651 | v:Destroy() | |
652 | end | |
653 | end | |
654 | end | |
655 | ||
656 | if p.Character.Parent == nil then | |
657 | local model = Instance.new("Model") | |
658 | model.Name = p.Name | |
659 | p.Character = model | |
660 | for i,v in pairs(char:GetChildren()) do | |
661 | v.Parent = p.Character | |
662 | end | |
663 | end | |
664 | ||
665 | char = p.Character | |
666 | if p.Character.Parent ~= workspace then | |
667 | p.Character.Parent = workspace | |
668 | end | |
669 | for i,v in pairs(char:GetChildren()) do | |
670 | if v:IsA("Accoutrement") then | |
671 | if v.Handle:FindFirstChild("Mesh") then | |
672 | v.Handle:FindFirstChild("Mesh").Offset = Vector3.new() | |
673 | v.Handle.Transparency = 0 | |
674 | end | |
675 | elseif v:IsA("BasePart") then | |
676 | v.Anchored = false | |
677 | if v:FindFirstChildOfClass("BodyPosition") then | |
678 | v:FindFirstChildOfClass("BodyPosition"):Destroy() | |
679 | end | |
680 | if v:FindFirstChildOfClass("BodyVelocity") then | |
681 | v:FindFirstChildOfClass("BodyVelocity"):Destroy() | |
682 | end | |
683 | if v:FindFirstChildOfClass("BodyGyro") and v:FindFirstChildOfClass("BodyGyro").Name ~= "lolnochara" then | |
684 | v:FindFirstChildOfClass("BodyGyro"):Destroy() | |
685 | end | |
686 | if v:FindFirstChild("Mesh") then | |
687 | v:FindFirstChild("Mesh").Offset = Vector3.new() | |
688 | end | |
689 | if not DebrisModel:FindFirstChild(v.Name.."FORCEFIELD") then | |
690 | local force = Instance.new("Part",DebrisModel) | |
691 | force.Name = v.Name.."FORCEFIELD" | |
692 | if v ~= hed then | |
693 | force.Size = v.Size+(Vector3.new(1,1,1)*0.2) | |
694 | else | |
695 | force.Size = (Vector3.new(1,1,1)*v.Size.Y)+(Vector3.new(1,1,1)*0.2) | |
696 | end | |
697 | force.CanCollide = false | |
698 | force.Transparency = 1 | |
699 | force.Color = Color3.new(0,1,1) | |
700 | force.Material = Enum.Material.Neon | |
701 | newWeld(v,force,0,0,0) | |
702 | else | |
703 | if not DebrisModel:FindFirstChild(v.Name.."FORCEFIELD"):FindFirstChildOfClass("Weld") then | |
704 | newWeld(v,DebrisModel:FindFirstChild(v.Name.."FORCEFIELD"),0,0,0) | |
705 | end | |
706 | end | |
707 | if v.Name ~= "HumanoidRootPart" then | |
708 | v.Transparency = 0 | |
709 | else | |
710 | v.Transparency = 1 | |
711 | end | |
712 | end | |
713 | end | |
714 | ||
715 | if -root.Velocity.Y/1.5 > -5 and -root.Velocity.Y/1.5 < 150 then | |
716 | velocityYFall = root.Velocity.Y/1.5 | |
717 | else | |
718 | if -root.Velocity.Y/1.5 < -5 then | |
719 | velocityYFall = 5 | |
720 | elseif -root.Velocity.Y/1.5 > 150 then | |
721 | velocityYFall = -150 | |
722 | end | |
723 | end | |
724 | ||
725 | if -root.Velocity.Y/180 > 0 and -root.Velocity.Y/180 < 1.2 then | |
726 | velocityYFall2 = root.Velocity.Y/180 | |
727 | else | |
728 | if -root.Velocity.Y/180 < 0 then | |
729 | velocityYFall2 = 0 | |
730 | elseif -root.Velocity.Y/180 > 1.2 then | |
731 | velocityYFall2 = -1.2 | |
732 | end | |
733 | end | |
734 | ||
735 | if -root.Velocity.Y/1.5 > -5 and -root.Velocity.Y/1.5 < 50 then | |
736 | velocityYFall3 = root.Velocity.Y/1.5 | |
737 | else | |
738 | if -root.Velocity.Y/1.5 < -5 then | |
739 | velocityYFall3 = 5 | |
740 | elseif -root.Velocity.Y/1.5 > 50 then | |
741 | velocityYFall3 = -50 | |
742 | end | |
743 | end | |
744 | ||
745 | if -root.Velocity.Y/1.5 > -50 and -root.Velocity.Y/1.5 < 20 then | |
746 | velocityYFall4 = root.Velocity.Y/1.5 | |
747 | else | |
748 | if -root.Velocity.Y/180 < -5 then | |
749 | velocityYFall4 = 5 | |
750 | elseif -root.Velocity.Y/180 > 50 then | |
751 | velocityYFall4 = -50 | |
752 | end | |
753 | end | |
754 | ||
755 | if root.RotVelocity.Y/6 < 1 and root.RotVelocity.Y/6 > -1 then | |
756 | neckrotY = root.RotVelocity.Y/6 | |
757 | else | |
758 | if root.RotVelocity.Y/6 < -1 then | |
759 | neckrotY = -1 | |
760 | elseif root.RotVelocity.Y/6 > 1 then | |
761 | neckrotY = 1 | |
762 | end | |
763 | end | |
764 | ||
765 | if root.RotVelocity.Y/8 < 0.6 and root.RotVelocity.Y/8 > -0.6 then | |
766 | neckrotY2 = root.RotVelocity.Y/8 | |
767 | else | |
768 | if root.RotVelocity.Y/8 < -0.6 then | |
769 | neckrotY2 = -0.6 | |
770 | elseif root.RotVelocity.Y/8 > 0.6 then | |
771 | neckrotY2 = 0.6 | |
772 | end | |
773 | end | |
774 | ||
775 | if root.RotVelocity.Y/6 < 0.2 and root.RotVelocity.Y/6 > -0.2 then | |
776 | torsorotY = root.RotVelocity.Y/6 | |
777 | else | |
778 | if root.RotVelocity.Y/6 < -0.2 then | |
779 | torsorotY = -0.2 | |
780 | elseif root.RotVelocity.Y/6 > 0.2 then | |
781 | torsorotY = 0.2 | |
782 | end | |
783 | end | |
784 | ||
785 | if root.RotVelocity.Y/8 < 0.2 and root.RotVelocity.Y/8 > -0.2 then | |
786 | torsorotY2 = root.RotVelocity.Y/8 | |
787 | else | |
788 | if root.RotVelocity.Y/8 < -0.2 then | |
789 | torsorotY2 = -0.2 | |
790 | elseif root.RotVelocity.Y/8 > 0.2 then | |
791 | torsorotY2 = 0.2 | |
792 | end | |
793 | end | |
794 | ||
795 | torsoY = -(torso.Velocity*Vector3.new(1, 0, 1)).magnitude/20 | |
796 | torsoY2 = -(torso.Velocity*Vector3.new(1, 0, 1)).magnitude/36 | |
797 | ||
798 | local ray1 = Ray.new(root.Position+Vector3.new(size,0,0),Vector3.new(0, -4, 0)) | |
799 | local part1, endPoint = workspace:FindPartOnRay(ray1, char) | |
800 | ||
801 | local ray2 = Ray.new(root.Position-Vector3.new(size,0,0),Vector3.new(0, -4, 0)) | |
802 | local part2, endPoint = workspace:FindPartOnRay(ray2, char) | |
803 | ||
804 | local ray3 = Ray.new(root.Position+Vector3.new(0,0,size/2),Vector3.new(0, -4, 0)) | |
805 | local part3, endPoint = workspace:FindPartOnRay(ray3, char) | |
806 | ||
807 | local ray4 = Ray.new(root.Position-Vector3.new(0,0,size/2),Vector3.new(0, -4, 0)) | |
808 | local part4, endPoint = workspace:FindPartOnRay(ray4, char) | |
809 | ||
810 | local ray5 = Ray.new(root.Position+Vector3.new(size,0,size/2),Vector3.new(0, -4, 0)) | |
811 | local part5, endPoint = workspace:FindPartOnRay(ray5, char) | |
812 | ||
813 | local ray6 = Ray.new(root.Position-Vector3.new(size,0,size/2),Vector3.new(0, -4, 0)) | |
814 | local part6, endPoint = workspace:FindPartOnRay(ray6, char) | |
815 | ||
816 | local ray7 = Ray.new(root.Position+Vector3.new(size,0,-size/2),Vector3.new(0, -4, 0)) | |
817 | local part7, endPoint = workspace:FindPartOnRay(ray7, char) | |
818 | ||
819 | local ray8 = Ray.new(root.Position-Vector3.new(size,0,-size/2),Vector3.new(0, -4, 0)) | |
820 | local part8, endPoint = workspace:FindPartOnRay(ray8, char) | |
821 | ||
822 | local ray = Ray.new(root.Position,Vector3.new(0, -6, 0)) | |
823 | local part, endPoint = workspace:FindPartOnRay(ray, char) | |
824 | ||
825 | if part1 or part2 or part3 or part4 or part5 or part6 or part7 or part8 then jumped = false else endPoint = 0 jumped = true end | |
826 | ||
827 | local rlegray = Ray.new(rleg.Position+Vector3.new(0,size/2,0),Vector3.new(0, -1.75, 0)) | |
828 | local rlegpart, rlegendPoint = workspace:FindPartOnRay(rlegray, char) | |
829 | ||
830 | local llegray = Ray.new(lleg.Position+Vector3.new(0,size/2,0),Vector3.new(0, -1.75, 0)) | |
831 | local llegpart, llegendPoint = workspace:FindPartOnRay(llegray, char) | |
832 | ||
833 | if hum.Health > 0 and noidle == false then | |
834 | if hum.Sit == false then | |
835 | if (torso.Velocity*Vector3.new(1, 0, 1)).magnitude >= 5 and jumped == false then | |
836 | hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0, 1.5, -.2) * CFrame.Angles(math.rad((torso.Velocity*Vector3.new(1, 0, 1)).magnitude/35),torsorotY, math.rad(0)+torsorotY), 0.4) | |
837 | hed.Weld.C1 = Lerp(hed.Weld.C1, CFrame.Angles((change/10)*math.cos(sine/2)+0.1,-(change/10)*math.cos(sine/4)-(torsorotY/5),(change/5)*math.cos(sine/4)), 0.1) | |
838 | rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.62-(movement/40)*math.cos(sine/4)/3,(movement/150)+(movement/40)*math.cos(sine/4))*CFrame.Angles(math.rad(-5-(movement*2)*math.cos(sine/4))+ -(movement/10)*math.sin(sine/4)*2,math.rad(0-(movement*2)*math.cos(sine/4)),math.rad(0)), 0.2) | |
839 | larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.62+(movement/40)*math.cos(sine/4)/3,(movement/150)-(movement/40)*math.cos(sine/4))*CFrame.Angles(math.rad(-5+(movement*2)*math.cos(sine/4))+ (movement/10)*math.sin(sine/4)*2,math.rad(0-(movement*2)*math.cos(sine/4)),math.rad(0)), 0.2) | |
840 | torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -0.5+(change*2)*math.sin(sine/2), 0) * CFrame.Angles(math.rad(30+(change*20)-(movement/20)*math.cos(sine/2)), torsorotY2+math.rad(0-20*math.sin(sine/4)), torsorotY2+math.rad(0-1*math.cos(sine/4))), 0.1) | |
841 | lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5,(-0.85-(movement/15)*math.cos(sine/4)/2),-0.1+(movement/15)*math.cos(sine/4))*CFrame.Angles(math.rad(-50+(change*5)-movement*math.cos(sine/4))+ -(movement/10)*math.sin(sine/4),math.rad(0+(movement*2)*math.cos(sine/4)),math.rad(0)), 0.2) | |
842 | rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5,(-0.85+(movement/15)*math.cos(sine/4)/2),-0.1-(movement/15)*math.cos(sine/4))*CFrame.Angles(math.rad(-50+(change*5)+movement*math.cos(sine/4))+ (movement/10)*math.sin(sine/4),math.rad(0+(movement*2)*math.cos(sine/4)),math.rad(0)), 0.2) | |
843 | elseif jumped == true then | |
844 | didjump = true | |
845 | jumppower = root.Velocity.Y | |
846 | hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0, 1.5, -.1) * CFrame.Angles(0,0,0), 0.4) | |
847 | hed.Weld.C1 = Lerp(hed.Weld.C1, CFrame.Angles(0,0,0), 0.1) | |
848 | larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.55,0) * CFrame.Angles(math.rad(0),math.rad(0), math.rad(0)), 0.1) | |
849 | rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.55,0) * CFrame.Angles(math.rad(0),math.rad(0), math.rad(0)), 0.1) | |
850 | torso.Weld.C0 = CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(math.random(-90,90)),math.rad(0), math.rad(math.random(-180,180))) | |
851 | lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5,-0.925,0) * CFrame.Angles(math.rad(0),math.rad(0), math.rad(0)), 0.1) | |
852 | rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5,0,-0.8) * CFrame.Angles(math.rad(0),math.rad(0), math.rad(0)), 0.1) | |
853 | elseif (torso.Velocity*Vector3.new(1, 0, 1)).magnitude < 5 then | |
854 | hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0, 1.5, -.1), 0.4) | |
855 | hed.Weld.C1 = Lerp(hed.Weld.C1, CFrame.Angles(math.rad(0+50*math.sin(sine/4)),0,0), 0.1) | |
856 | larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.55,-0.05-0.2*math.cos(sine/4))*CFrame.Angles(math.rad(0+80*math.sin(sine/4)),math.rad(-5-5*math.sin(sine/8)),math.rad(-6+2*math.cos(sine/8))), 0.2) | |
857 | rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.55,-0.05-0.2*math.cos(sine/4))*CFrame.Angles(math.rad(0+80*math.sin(sine/4)),math.rad(5+5*math.sin(sine/8)),math.rad(6-2*math.cos(sine/8))), 0.2) | |
858 | torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1.1-hum.HipHeight, 0+2*math.cos(sine/4)) * CFrame.Angles(math.rad(0-80*math.cos(sine/4)),math.rad(0), math.rad(0-1*math.cos(sine/32))), 0.1) | |
859 | lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(0,llegendPoint.Y-lleg.Position.Y,0)*CFrame.new(-0.5,0,0)*CFrame.Angles(math.rad(0+120*math.cos(sine/4)),math.rad(10),math.rad(-5+1*math.cos(sine/16))), 0.1) | |
860 | rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0,rlegendPoint.Y-rleg.Position.Y,0)*CFrame.new(0.5,0,0)*CFrame.Angles(math.rad(0+120*math.cos(sine/4)),math.rad(-10),math.rad(5+1*math.cos(sine/16))), 0.1) | |
861 | end | |
862 | ||
863 | else | |
864 | hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0, 1.5, -.1), 0.4) | |
865 | hed.Weld.C1 = Lerp(hed.Weld.C1, CFrame.Angles(0.05*math.sin(sine/16)+0.15,0.05*math.cos(sine/32),0.01*math.cos(sine/32)), 0.1) | |
866 | larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.55-(0.1)*math.cos(sine/16)/3,-0.05-0.1*math.cos(sine/16))*CFrame.Angles(math.rad(-2+4*math.sin(sine/16)),math.rad(-5-5*math.sin(sine/16)),math.rad(-6+2*math.cos(sine/16))), 0.2) | |
867 | rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.55-(0.1)*math.cos(sine/16)/3,-0.05-0.1*math.cos(sine/16))*CFrame.Angles(math.rad(-2+4*math.sin(sine/16)),math.rad(5+5*math.sin(sine/16)),math.rad(6-2*math.cos(sine/16))), 0.2) | |
868 | torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1.4-(0.1)*math.cos(sine/16)-hum.HipHeight, 0) * CFrame.Angles(math.rad(0-2*math.cos(sine/16)),math.rad(0), math.rad(0-1*math.cos(sine/32))), 0.1) | |
869 | lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5,-0.55+(0.1)*math.cos(sine/16),0)*CFrame.Angles(math.rad(80+2*math.cos(sine/16)),math.rad(4),math.rad(-2+1*math.cos(sine/32))), 0.2) | |
870 | rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5,-0.55+(0.1)*math.cos(sine/16),0)*CFrame.Angles(math.rad(80+2*math.cos(sine/16)),math.rad(-4),math.rad(2+1*math.cos(sine/32))), 0.2) | |
871 | end | |
872 | ||
873 | end | |
874 | if didjump == true and jumped == false and jumppower < 0 then | |
875 | didjump = false | |
876 | jumpimpact() | |
877 | end | |
878 | ||
879 | sine = sine + change | |
880 | hum.Health = math.huge | |
881 | hum.MaxHealth = math.huge | |
882 | end) |