SHOW:
|
|
- or go back to the newest paste.
1 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
2 | local Player,Mouse,mouse,UserInputService,ContextActionService = owner | |
3 | local RealPlayer = Player | |
4 | do print("FE Compatibility code by Mokiros");InternalData = {}InternalData.RealOwner = owner;InternalData.RealObjs = {};InternalData.SoundLoudness = {};local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end,__call=function(self,...)local t=rawget(self,"_RealService")if t then return t(...)end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return self[t]end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;x.RunService=v({RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")setmetatable(x,{__index=function(self,t)return r:GetService(t)or typeof(r[t])=="function"and function(m,...)return r[t](r,...)end or r[t]end,__newindex=s.__newindex,__call=s.__call})game,owner=x,x.Players.LocalPlayer | |
5 | script.Parent = InternalData.RealOwner.Character | |
6 | local Event = Instance.new("RemoteEvent");Event.Name = "UserInput";InternalData.Event = Event | |
7 | local function createObject (connections, index) | |
8 | local proxy = newproxy (true);local meta = getmetatable (proxy); | |
9 | local runbind = function (self, i, ...) connections[i]:Fire (...); end; | |
10 | while (#connections > 0) do connections[table.remove(connections, 1)] = Instance.new ('BindableEvent');end; | |
11 | meta.__index = function (self, i) | |
12 | if (i == 'TriggerEvent') then return runbind end; | |
13 | return connections[i] and connections[i].Event or index[i]; | |
14 | end; | |
15 | meta.__newindex = index;meta.__metatable = false;return proxy | |
16 | end; | |
17 | local Mouse = createObject({"KeyUp","KeyDown","Button1Down","Button1Up"},{["Target"] = nil;["Hit"] = CFrame.new()}) | |
18 | local UserInputService = createObject({"InputBegan","InputEnded"},{}) | |
19 | local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...) | |
20 | self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil | |
21 | end};ContextActionService.UnBindAction = ContextActionService.BindAction | |
22 | Event.OnServerEvent:Connect(function(FiredBy,Input) | |
23 | if FiredBy ~= InternalData.RealOwner then return end | |
24 | if Input.MouseEvent then | |
25 | Mouse.Target = Input.Target;Mouse.Hit = Input.Hit | |
26 | elseif Input.Sound then | |
27 | if InternalData.SoundLoudness[Input.Sound] then InternalData.SoundLoudness[Input.Sound] = Input.Loudness end | |
28 | else | |
29 | local Begin = Input.UserInputState == Enum.UserInputState.Begin | |
30 | if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TriggerEvent(Begin and "Button1Down" or "Button1Up") end | |
31 | for _,Action in pairs(ContextActionService.Actions) do | |
32 | for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end | |
33 | end | |
34 | Mouse:TriggerEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower());UserInputService:TriggerEvent(Begin and "InputBegan" or "InputEnded",Input,false) | |
35 | end | |
36 | end) | |
37 | InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService | |
38 | Event.Parent = NLS([[ | |
39 | local Player = owner; | |
40 | local Sounds = {}; | |
41 | local Event = script:WaitForChild("UserInput"); | |
42 | local UserInputService = game:GetService("UserInputService"); | |
43 | local Mouse = Player:GetMouse(); | |
44 | local Input = function(Input,gameProcessedEvent) | |
45 | if gameProcessedEvent then return end | |
46 | Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState}) | |
47 | end | |
48 | Event.OnClientEvent:connect(function(Args) | |
49 | if Args[1] == "NewSound" then table.insert(Sounds,Args[2]) end | |
50 | end) | |
51 | UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input) | |
52 | local Hit,Target | |
53 | while wait(1/30) do | |
54 | for x,Sound in pairs(Sounds) do | |
55 | if Sound.Parent then Event:FireServer({["Sound"]=Sound,["Loudness"]=Sound.PlaybackLoudness}) end | |
56 | end | |
57 | if Hit ~= Mouse.Hit or Target ~= Mouse.Target then | |
58 | Hit = Mouse.Hit;Target = Mouse.Target; | |
59 | Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit}) | |
60 | end | |
61 | end | |
62 | ]],InternalData.RealOwner.Character) | |
63 | end | |
64 | InternalData.NewOwner = setmetatable({},{ | |
65 | __index = function (self,Index) | |
66 | local Type = type(InternalData.RealOwner[Index]) | |
67 | if Type == "function" then | |
68 | if Index:lower() == "getmouse" or Index:lower() == "mouse" then | |
69 | return function (self)return InternalData["Mouse"] end | |
70 | end | |
71 | return function (self,...)return InternalData.RealOwner[Index](InternalData.RealOwner,...) end | |
72 | elseif Index == "FakePlayer" then | |
73 | return true | |
74 | end | |
75 | return InternalData.RealOwner[Index] | |
76 | end; | |
77 | __tostring = function(self) return tostring(InternalData.RealOwner) end | |
78 | }) | |
79 | --LoadLibrary("RbxUtility").Create | |
80 | InternalData.LoadLibrary = LoadLibrary;LoadLibrary = function(Library) | |
81 | if Library == "RbxUtility" then | |
82 | return setmetatable({},{ | |
83 | __tostring = function() return "RbxUtility" end; | |
84 | __index = function(self, Index) | |
85 | if Index:lower() == "create" then | |
86 | return function(Type) | |
87 | return function(Data) | |
88 | Data = Data or {} | |
89 | local Inst = Instance.new(Type) | |
90 | for x,y in pairs(Data) do | |
91 | if InternalData.RealObjs[y] then y = InternalData.RealObjs[y] end | |
92 | if y == owner then y = InternalData.RealOwner end | |
93 | Inst[x] = y | |
94 | end | |
95 | return Inst | |
96 | end | |
97 | end | |
98 | end | |
99 | return InternalData.LoadLibrary(Library)[Index] | |
100 | end | |
101 | }) | |
102 | end | |
103 | return InternalData.LoadLibrary(Library) | |
104 | end | |
105 | InternalData.RealInstance = Instance;Instance = setmetatable({},{ | |
106 | __index = function (self,Index) | |
107 | if Index:lower() == 'new' then | |
108 | return function (Type, Parent) | |
109 | if Parent == owner then Parent = InternalData.RealOwner end | |
110 | if InternalData.RealObjs[Parent] then Parent = InternalData.RealObjs[Parent] end | |
111 | local Real = InternalData.RealInstance.new(Type,Parent) | |
112 | if not Type then return end | |
113 | if Type == "BillboardGui" then | |
114 | local ToReturn = setmetatable({},{ | |
115 | __index = function (self,Index) | |
116 | if type(Real[Index]) == "function" then | |
117 | if Index:lower() == "clone" then | |
118 | return function (self) | |
119 | local Real = Real:Clone() | |
120 | local ToReturn = setmetatable({RealObject = Real},{ | |
121 | __index = function (self,Index) | |
122 | if type(Real[Index]) == "function" then return function (self,...) return Real[Index](Real,...)end end | |
123 | return Real[Index] | |
124 | end; | |
125 | __newindex = function (self,Index,Value) | |
126 | if InternalData.RealObjs[Value] then Value = InternalData.RealObjs[Value] end | |
127 | if Value == owner then Value = InternalData.RealOwner end | |
128 | Real[Index] = Value | |
129 | end; | |
130 | __tostring = function(self) return tostring(Real) end; | |
131 | }) | |
132 | InternalData.RealObjs[ToReturn] = Real;return ToReturn; | |
133 | end | |
134 | end | |
135 | return function (self,...) return Real[Index](Real,...)end | |
136 | end | |
137 | return Real[Index] | |
138 | end; | |
139 | __newindex = function (self,Index,Value) | |
140 | if InternalData.RealObjs[Value] then Value = InternalData.RealObjs[Value] end | |
141 | if Value == owner then Value = InternalData.RealOwner end | |
142 | Real[Index] = Value | |
143 | end; | |
144 | __tostring = function(self) return tostring(Real) end; | |
145 | }) | |
146 | InternalData.RealObjs[ToReturn] = Real;return ToReturn; | |
147 | elseif Type:lower() == "sound" then | |
148 | Real.Parent = owner.Character; | |
149 | local ToReturn = setmetatable({RealObject = Real},{ | |
150 | __index = function (self,Index) | |
151 | if Index:lower() == "playbackloudness" then | |
152 | return InternalData.SoundLoudness[Real] or 0 | |
153 | elseif type(Real[Index]) == "function" then | |
154 | if Index:lower() == "clone" then | |
155 | return function (self) | |
156 | local Real = Real:Clone() | |
157 | local ToReturn = setmetatable({},{ | |
158 | __index = function (self,Index) | |
159 | if type(Real[Index]) == "function" then return function (self,...) return Real[Index](Real,...)end end | |
160 | return Real[Index] | |
161 | end; | |
162 | __newindex = function (self,Index,Value) | |
163 | if InternalData.RealObjs[Value] then Value = InternalData.RealObjs[Value] end | |
164 | if Value == owner then Value = InternalData.RealOwner end | |
165 | Real[Index] = Value | |
166 | end; | |
167 | __tostring = function(self) return tostring(Real) end; | |
168 | }) | |
169 | InternalData.RealObjs[ToReturn] = Real;return ToReturn; | |
170 | end | |
171 | end | |
172 | return function (self,...) return Real[Index](Real,...)end | |
173 | end | |
174 | return Real[Index] | |
175 | end; | |
176 | __newindex = function (self,Index,Value) | |
177 | if InternalData.RealObjs[Value] then Value = InternalData.RealObjs[Value] end | |
178 | if Value == owner then Value = InternalData.RealOwner end | |
179 | Real[Index] = Value | |
180 | end; | |
181 | __tostring = function(self) return tostring(Real) end; | |
182 | }) | |
183 | InternalData.RealObjs[ToReturn] = Real;InternalData.SoundLoudness[Real] = 0;repeat wait() until InternalData.Event.Parent InternalData.Event:FireClient(InternalData.RealOwner,{"NewSound",Real}) return ToReturn; | |
184 | else | |
185 | local ToReturn = setmetatable({RealObject = Real},{ | |
186 | __index = function (self,Index) | |
187 | if type(Real[Index]) == "function" then | |
188 | if Index:lower() == "clone" then | |
189 | return function (self) | |
190 | local Real = Real:Clone() | |
191 | local ToReturn = setmetatable({},{ | |
192 | __index = function (self,Index) | |
193 | if type(Real[Index]) == "function" then return function (self,...) return Real[Index](Real,...)end end | |
194 | return Real[Index] | |
195 | end; | |
196 | __newindex = function (self,Index,Value) | |
197 | if InternalData.RealObjs[Value] then Value = InternalData.RealObjs[Value] end | |
198 | if Value == owner then Value = InternalData.RealOwner end | |
199 | Real[Index] = Value | |
200 | end; | |
201 | __tostring = function(self) return tostring(Real) end; | |
202 | }) | |
203 | InternalData.RealObjs[ToReturn] = Real;return ToReturn; | |
204 | end | |
205 | end | |
206 | return function (self,...) return Real[Index](Real,...)end | |
207 | end | |
208 | return Real[Index] | |
209 | end; | |
210 | __newindex = function (self,Index,Value) | |
211 | if InternalData.RealObjs[Value] then Value = InternalData.RealObjs[Value] end | |
212 | if Value == owner then Value = InternalData.RealOwner end | |
213 | Real[Index] = Value | |
214 | end; | |
215 | __tostring = function(self) return tostring(Real) end; | |
216 | }) | |
217 | InternalData.RealObjs[ToReturn] = Real;return ToReturn; | |
218 | end | |
219 | end | |
220 | end | |
221 | return InternalData.RealInstance[Index] | |
222 | end; | |
223 | __tostring = function(self) return tostring(InternalData.RealInstance) end; | |
224 | }); | |
225 | InternalData.RealGame = game;game = setmetatable({},{ | |
226 | __index = function (self,Index) | |
227 | if InternalData.RealGame[Index] then | |
228 | local Type = type(InternalData.RealGame[Index]) | |
229 | if Type == "function" then | |
230 | if Index:lower() == "getservice" or Index:lower() == "service" then | |
231 | return function (self,Service) | |
232 | local FakeServices = { | |
233 | ["players"] = function() | |
234 | return setmetatable({},{ | |
235 | __index = function (self2,Index2) | |
236 | local RealService = InternalData.RealGame:GetService(Service) | |
237 | local Type2 = type(RealService[Index2]) | |
238 | if Type2 == "function" then | |
239 | return function (self,...) return RealService[Index2](RealService,...)end | |
240 | else | |
241 | if Index2:lower() == "localplayer" then return InternalData.NewOwner end | |
242 | return RealService[Index2] | |
243 | end | |
244 | end; | |
245 | __tostring = function(self) return tostring(InternalData.RealGame:GetService(Service)) end | |
246 | }) | |
247 | end; | |
248 | ["contextactionservice"] = function() return InternalData["ContextActionService"] end; | |
249 | ["userinputservice"] = function() return InternalData["UserInputService"] end; | |
250 | ["debris"] = function() | |
251 | return setmetatable({},{ | |
252 | __index = function(self2,Index2) | |
253 | local RealService = InternalData.RealGame:GetService(Service) | |
254 | local Type2 = type(RealService[Index2]) | |
255 | if Type2 == "function" then | |
256 | if Index2:lower() == "additem" then | |
257 | return function (self,Item,Time) | |
258 | if InternalData.RealObjs[Item] then Item = InternalData.RealObjs[Item] end | |
259 | return RealService:AddItem(Item,Time) | |
260 | end | |
261 | end | |
262 | return function (self,...) return RealService[Index2](RealService,...) end | |
263 | end | |
264 | return RealService[Index2] | |
265 | end; | |
266 | __tostring = function(self) return tostring(InternalData.RealGame:GetService("Debris")) end | |
267 | }) | |
268 | end; | |
269 | ["runservice"] = function() | |
270 | return setmetatable({},{ | |
271 | __index = function(self2,Index2) | |
272 | local RealService = InternalData.RealGame:GetService(Service) | |
273 | local Type2 = type(RealService[Index2]) | |
274 | if Type2 == "function" then | |
275 | return function (self,...) return RealService[Index2](RealService,...) end | |
276 | else | |
277 | local RunServices = { | |
278 | ["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return InternalData.RealGame:GetService("RunService").Stepped:Connect(Function) end end; | |
279 | ["renderstepped"] = function() return RealService["Stepped"] end | |
280 | } | |
281 | if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end | |
282 | return RealService[Index2] | |
283 | end | |
284 | end; | |
285 | __tostring = function(self) return tostring(InternalData.RealGame:GetService("RunService")) end | |
286 | }) | |
287 | end | |
288 | } | |
289 | if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end | |
290 | return InternalData.RealGame:GetService(Service) | |
291 | end | |
292 | end | |
293 | return function (self,...) return InternalData.RealGame[Index](InternalData.RealGame,...) end | |
294 | else | |
295 | if game:GetService(Index) then return game:GetService(Index) end | |
296 | return InternalData.RealGame[Index] | |
297 | end | |
298 | end | |
299 | return nil | |
300 | end; | |
301 | __tostring = function(self) return tostring(InternalData.game) end | |
302 | });Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("Complete!") | |
303 | ||
304 | local oldtick = tick() | |
305 | warn("Animation rig - By Mewy23") | |
306 | local plr = game:GetService("Players").LocalPlayer | |
307 | local char, mouse = plr.Character, plr:GetMouse() | |
308 | local hitTab = {} | |
309 | local fadeTab = {} | |
310 | local spd = 0.95 | |
311 | local sound1 = Instance.new("Sound", char.HumanoidRootPart) | |
312 | local sound2 = Instance.new("Sound", char.HumanoidRootPart) | |
313 | local sound3 = Instance.new("Sound") | |
314 | sound1.SoundId = "rbxassetid://130767866" | |
315 | sound1.Volume = 10 | |
316 | sound2.SoundId = "rbxassetid://142684400" | |
317 | sound2.Volume = 10 | |
318 | sound3.SoundId = "rbxassetid://318480818" | |
319 | sound3.Volume = 10 | |
320 | local particle = Instance.new("ParticleEmitter") | |
321 | particle.LightEmission = 0.2 | |
322 | particle.Texture = "rbxassetid://50263573" | |
323 | particle.Size = NumberSequence.new({ | |
324 | NumberSequenceKeypoint.new(0, 0), | |
325 | NumberSequenceKeypoint.new(0.5, 1), | |
326 | NumberSequenceKeypoint.new(1, 0) | |
327 | }) | |
328 | particle.Acceleration = Vector3.new(0, 0, 0) | |
329 | particle.Lifetime = NumberRange.new(0.15, 0.3) | |
330 | particle.Rate = 50 | |
331 | particle.Rotation = NumberRange.new(0, 360) | |
332 | particle.RotSpeed = NumberRange.new(0, 0) | |
333 | particle.Speed = NumberRange.new(0, 0) | |
334 | local dfj = {} | |
335 | char:WaitForChild("Animate"):Destroy() | |
336 | char:WaitForChild("Humanoid"):WaitForChild("Animator"):Destroy() | |
337 | for i, v in pairs(char:FindFirstChild("Torso"):GetChildren()) do | |
338 | if v:IsA("Motor6D") and v.Name ~= "Neck" then | |
339 | table.insert(dfj, v:Clone()) | |
340 | v:Destroy() | |
341 | end | |
342 | end | |
343 | local state = "idle" | |
344 | local rootpart = char:FindFirstChild("HumanoidRootPart") | |
345 | local rootjoint = rootpart:FindFirstChild("RootJoint") | |
346 | rootjoint.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(180)) | |
347 | local rarm = Instance.new("Weld", char:FindFirstChild("Right Arm") or nil) | |
348 | rarm.Part0 = char:FindFirstChild("Torso") or nil | |
349 | rarm.Part1 = char:FindFirstChild("Right Arm") or nil | |
350 | rarm.C0 = CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
351 | rarm.C1 = CFrame.new(-0.5, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
352 | local larm = Instance.new("Weld", char:FindFirstChild("Left Arm") or nil) | |
353 | larm.Part0 = char:FindFirstChild("Torso") or nil | |
354 | larm.Part1 = char:FindFirstChild("Left Arm") or nil | |
355 | larm.C0 = CFrame.new(-1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
356 | larm.C1 = CFrame.new(0.5, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
357 | local rleg = Instance.new("Weld", char:FindFirstChild("Right Leg") or nil) | |
358 | rleg.Part0 = char:FindFirstChild("Torso") or nil | |
359 | rleg.Part1 = char:FindFirstChild("Right Leg") or nil | |
360 | rleg.C0 = CFrame.new(1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
361 | rleg.C1 = CFrame.new(0.5, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
362 | local lleg = Instance.new("Weld", char:FindFirstChild("Left Leg") or nil) | |
363 | lleg.Part0 = char:FindFirstChild("Torso") or nil | |
364 | lleg.Part1 = char:FindFirstChild("Left Leg") or nil | |
365 | lleg.C0 = CFrame.new(-1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
366 | lleg.C1 = CFrame.new(-0.5, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
367 | local neck = char:FindFirstChild("Torso"):FindFirstChild("Neck") or nil | |
368 | neck.Part0 = char:FindFirstChild("Torso") or nil | |
369 | neck.Part1 = char:FindFirstChild("Head") or nil | |
370 | neck.C0 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
371 | neck.C1 = CFrame.new(0, -0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
372 | function hitSphere() | |
373 | local function recSearch(par) | |
374 | local tab = {} | |
375 | local function rec(parent) | |
376 | if parent:IsA("Humanoid") and parent ~= char:FindFirstChildOfClass("Humanoid") then | |
377 | table.insert(tab, parent) | |
378 | end | |
379 | for i, v in pairs(parent:GetChildren()) do | |
380 | rec(v) | |
381 | end | |
382 | end | |
383 | rec(par) | |
384 | return tab | |
385 | end | |
386 | local humsFound = {} | |
387 | for i, v in pairs(recSearch(workspace)) do | |
388 | table.insert(humsFound, v) | |
389 | end | |
390 | return humsFound | |
391 | end | |
392 | mouse.Button1Down:connect(function() | |
393 | if state ~= "busy" then | |
394 | state = "busy" | |
395 | do | |
396 | local foundHums = {} | |
397 | local prtcls = {} | |
398 | local sounds = {} | |
399 | local parts = {} | |
400 | sound1:Play() | |
401 | local hit = false | |
402 | local toggle = false | |
403 | local frmcon | |
404 | local frame = 0 | |
405 | frmcon = game:service("RunService").RenderStepped:connect(function() | |
406 | frame = frame + 1 | |
407 | if frame / 4 == math.floor(frame / 4) then | |
408 | if toggle == false then | |
409 | toggle = true | |
410 | else | |
411 | toggle = false | |
412 | end | |
413 | end | |
414 | if toggle == true then | |
415 | rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1 - math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
416 | lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1 - math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
417 | rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(45)), spd * 1.5) | |
418 | larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5, 0) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(90)), spd * 1.5) | |
419 | rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(225)), spd * 1.5) | |
420 | neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(-45), math.rad(0)), spd * 1.5) | |
421 | else | |
422 | rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1 - math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
423 | lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1 - math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
424 | rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(-90)), spd * 1.5) | |
425 | larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5, 0) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(-45)), spd * 1.5) | |
426 | rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(135)), spd * 1.5) | |
427 | neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(45), math.rad(0)), spd * 1.5) | |
428 | end | |
429 | if frame % 5 == 0 then | |
430 | for i, v in pairs(hitSphere()) do | |
431 | for o, b in pairs(v.Parent:GetChildren()) do | |
432 | if b:IsA("BasePart") and 7 >= (b.Position - rootjoint.Parent.CFrame * CFrame.new(0, 0, -2.25).p).Magnitude then | |
433 | hit = true | |
434 | if foundHums[v] then | |
435 | foundHums[v] = foundHums[v] + 1 | |
436 | else | |
437 | foundHums[v] = 1 | |
438 | local ns = sound3:Clone() | |
439 | ns.Parent = b | |
440 | table.insert(sounds, ns) | |
441 | end | |
442 | if not prtcls[b] then | |
443 | partClone = particle:Clone() | |
444 | partClone.Enabled = false | |
445 | partClone.Parent = b | |
446 | prtcls[b] = partClone | |
447 | end | |
448 | local p = Instance.new("Part") | |
449 | p.Size = Vector3.new(0.2, 0.2, 0.2) | |
450 | p.Color = Color3.new(1, 1, 1) | |
451 | p.TopSurface = "Smooth" | |
452 | p.BottomSurface = "Smooth" | |
453 | p.Anchored = true | |
454 | p.CanCollide = false | |
455 | p.Shape = "Ball" | |
456 | p.CFrame = CFrame.new(b.CFrame.p + Vector3.new(math.random(-10, 10) / 10, math.random(-10, 10) / 10, math.random(-10, 10) / 10)) | |
457 | p.Parent = workspace | |
458 | table.insert(fadeTab, p) | |
459 | parts[b] = b | |
460 | end | |
461 | end | |
462 | end | |
463 | end | |
464 | end) | |
465 | local bucon | |
466 | bucon = mouse.Button1Up:connect(function() | |
467 | frmcon:disconnect() | |
468 | sound1:Stop() | |
469 | state = "idle" | |
470 | if hit == true then | |
471 | sound2:Play() | |
472 | wait(2.7) | |
473 | for i, v in pairs(sounds) do | |
474 | spawn(function() | |
475 | wait(math.random(0, 100) / 600) | |
476 | v.TimePosition = 2.5 | |
477 | v:Play() | |
478 | end) | |
479 | end | |
480 | wait(1.2) | |
481 | for i, v in pairs(prtcls) do | |
482 | v.Enabled = true | |
483 | end | |
484 | wait(1.3) | |
485 | spawn(function() | |
486 | local rcon | |
487 | local frame = 0 | |
488 | rcon = game:service("RunService").RenderStepped:connect(function() | |
489 | frame = frame + 1 | |
490 | for i, v in pairs(sounds) do | |
491 | v.Volume = 10 - frame / 5 | |
492 | if v.Volume <= 0 then | |
493 | v.Volume = 0 | |
494 | v:Destroy() | |
495 | end | |
496 | end | |
497 | if frame >= 200 then | |
498 | for i, v in pairs(sounds) do | |
499 | v:Destroy() | |
500 | end | |
501 | end | |
502 | end) | |
503 | end) | |
504 | wait(0.7) | |
505 | for i, v in pairs(prtcls) do | |
506 | v.Enabled = false | |
507 | end | |
508 | end | |
509 | bucon:disconnect() | |
510 | end) | |
511 | end | |
512 | end | |
513 | end) | |
514 | game:GetService("RunService").Heartbeat:connect(function() | |
515 | for i, v in pairs(fadeTab) do | |
516 | v.Transparency = v.Transparency + 0.1 | |
517 | local savecf = v.CFrame | |
518 | v.Size = v.Size + Vector3.new(0.3, 0.3, 0.3) | |
519 | v.CFrame = savecf | |
520 | end | |
521 | local isub = 0 | |
522 | for i = 1, #fadeTab do | |
523 | if fadeTab[i - isub].Transparency >= 1 then | |
524 | fadeTab[i - isub]:Destroy() | |
525 | table.remove(fadeTab, i - isub) | |
526 | isub = isub + 1 | |
527 | end | |
528 | end | |
529 | char:FindFirstChild("Humanoid").WalkSpeed = 26 | |
530 | spd = 0.2 * char:FindFirstChild("Humanoid").WalkSpeed / 16 | |
531 | if state ~= "busy" then | |
532 | local ray = Ray.new(rootpart.Position, Vector3.new(0, -4, 0)) | |
533 | local part, pos, normal = workspace:FindPartOnRayWithIgnoreList(ray, char:GetChildren(), false, true) | |
534 | if rootpart.Velocity.Magnitude > 0.5 and part ~= nil then | |
535 | state = "running" | |
536 | elseif rootpart.Velocity.Magnitude <= 0.5 and part ~= nil then | |
537 | state = "idle" | |
538 | elseif 0 < rootpart.Velocity.Y and part == nil then | |
539 | state = "jumping" | |
540 | elseif 0 >= rootpart.Velocity.Y and part == nil then | |
541 | state = "falling" | |
542 | end | |
543 | if state == "idle" then | |
544 | rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1 - math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
545 | lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1 - math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
546 | rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5 + math.cos(tick() + 0.5) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad((math.cos(tick()) + 1) / 16) * 20), spd) | |
547 | larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5 + math.cos(tick() + 0.5) / 16, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-(math.cos(tick()) + 1) / 16) * 20), spd) | |
548 | rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, math.cos(tick()) / 16, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(180)), spd) | |
549 | neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
550 | elseif state == "running" then | |
551 | rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1 - -math.sin(tick() * 8 + 90) / 8, math.sin(tick() * 8 + 90) / 10) * CFrame.Angles(math.rad(math.sin(tick() * 8) * 60), math.rad(0), math.rad(0)), spd) | |
552 | lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1 - math.sin(tick() * 8 + 90) / 8, -math.sin(tick() * 8 + 90) / 10) * CFrame.Angles(-math.rad(math.sin(tick() * 8) * 60), math.rad(0), math.rad(0)), spd) | |
553 | rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(math.sin(tick() * 8) * 80), math.rad(0), math.rad(0)), spd) | |
554 | larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5, 0) * CFrame.Angles(-math.rad(math.sin(tick() * 8) * 80), math.rad(0), math.rad(0)), spd) | |
555 | rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-110), math.rad(0), math.rad(180)), spd) | |
556 | neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)), spd) | |
557 | elseif state == "jumping" then | |
558 | rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
559 | lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
560 | rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
561 | larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
562 | rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(180)), spd) | |
563 | neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
564 | elseif state == "falling" then | |
565 | rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
566 | lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
567 | rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
568 | larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
569 | rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(180)), spd) | |
570 | neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
571 | end | |
572 | end | |
573 | end) | |
574 | warn("Loaded! Time elapsed: " .. tick() - oldtick) |