SHOW:
|
|
- or go back to the newest paste.
1 | - | --// Animation Base Created by SavageMunkey |
1 | + | if game:GetService("RunService"):IsClient() then error("Please run as a server script. Use h/ instead of hl/.") end |
2 | - | script.Name = 'gtfoh >_>' |
2 | + | print("FE Compatibility: by WaverlyCole & Mokiros") |
3 | InternalData = {} | |
4 | do | |
5 | script.Parent = owner.Character | |
6 | local Event = Instance.new("RemoteEvent") | |
7 | Event.Name = "UserInput" | |
8 | local function NewFakeEvent() | |
9 | local Fake = {fakeEvent=true,Connect=function(self,Func)self.Function=Func end}Fake.connect = Fake.Connect | |
10 | return Fake | |
11 | end | |
12 | local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()} | |
13 | local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()} | |
14 | local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...) | |
15 | self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil | |
16 | end};ContextActionService.UnBindAction = ContextActionService.BindAction | |
17 | local function TriggerEvent(self,Event,...) | |
18 | local Trigger = Mouse[Event] | |
19 | if Trigger and Trigger.fakeEvent and Trigger.Function then | |
20 | Trigger.Function(...) | |
21 | end | |
22 | end | |
23 | Mouse.TrigEvent = TriggerEvent | |
24 | UserInputService.TrigEvent = TriggerEvent | |
25 | Event.OnServerEvent:Connect(function(FiredBy,Input) | |
26 | if FiredBy.Name ~= owner.Name then end | |
27 | if Input.MouseEvent then | |
28 | Mouse.Target = Input.Target | |
29 | Mouse.Hit = Input.Hit | |
30 | else | |
31 | local Begin = Input.UserInputState == Enum.UserInputState.Begin | |
32 | if Input.UserInputType == Enum.UserInputType.MouseButton1 then | |
33 | return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up") | |
34 | end | |
35 | for _,Action in pairs(ContextActionService.Actions) do | |
36 | for _,Key in pairs(Action.Keys) do | |
37 | if Key==Input.KeyCode then | |
38 | Action.Function(Action.Name,Input.UserInputState,Input) | |
39 | end | |
40 | end | |
41 | end | |
42 | Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower()) | |
43 | UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false) | |
44 | end | |
45 | end) | |
46 | InternalData["Mouse"] = Mouse | |
47 | InternalData["ContextActionService"] = ContextActionService | |
48 | InternalData["UserInputService"] = UserInputService | |
49 | Event.Parent = NLS([[ | |
50 | local Player = owner | |
51 | local Event = script:WaitForChild("UserInput") | |
52 | local UserInputService = game:GetService("UserInputService") | |
53 | local Mouse = Player:GetMouse() | |
54 | local Input = function(Input,gameProcessedEvent) | |
55 | if gameProcessedEvent then return end | |
56 | Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState}) | |
57 | end | |
58 | UserInputService.InputBegan:Connect(Input) | |
59 | UserInputService.InputEnded:Connect(Input) | |
60 | local Hit,Target | |
61 | while wait(1/30) do | |
62 | if Hit ~= Mouse.Hit or Target ~= Mouse.Target then | |
63 | Hit,Target = Mouse.Hit,Mouse.Target | |
64 | Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit}) | |
65 | end | |
66 | end | |
67 | ]],owner.Character) | |
68 | end | |
69 | RealGame = game;game = setmetatable({},{ | |
70 | __index = function (self,Index) | |
71 | local Sandbox = function (Thing) | |
72 | if Thing:IsA("Player") then | |
73 | local RealPlayer = Thing | |
74 | return setmetatable({},{ | |
75 | __index = function (self,Index) | |
76 | local Type = type(RealPlayer[Index]) | |
77 | if Type == "function" then | |
78 | if Index:lower() == "getmouse" or Index:lower() == "mouse" then | |
79 | return function (self) | |
80 | return InternalData["Mouse"] | |
81 | end | |
82 | end | |
83 | return function (self,...) | |
84 | return RealPlayer[Index](RealPlayer,...) | |
85 | end | |
86 | else | |
87 | return RealPlayer[Index] | |
88 | end | |
89 | end; | |
90 | __tostring = function(self) | |
91 | return RealPlayer.Name | |
92 | end | |
93 | }) | |
94 | end | |
95 | end | |
96 | if RealGame[Index] then | |
97 | local Type = type(RealGame[Index]) | |
98 | if Type == "function" then | |
99 | if Index:lower() == "getservice" or Index:lower() == "service" then | |
100 | return function (self,Service) | |
101 | if Service:lower() == "players" then | |
102 | return setmetatable({},{ | |
103 | __index = function (self2,Index2) | |
104 | local RealService = RealGame:GetService(Service) | |
105 | local Type2 = type(Index2) | |
106 | if Type2 == "function" then | |
107 | return function (self,...) | |
108 | return RealService[Index2](RealService,...) | |
109 | end | |
110 | else | |
111 | if Index2:lower() == "localplayer" then | |
112 | return Sandbox(owner) | |
113 | end | |
114 | return RealService[Index2] | |
115 | end | |
116 | end; | |
117 | __tostring = function(self) | |
118 | return RealGame:GetService(Service).Name | |
119 | end | |
120 | }) | |
121 | elseif Service:lower() == "contextactionservice" then | |
122 | return InternalData["ContextActionService"] | |
123 | elseif Service:lower() == "contextactionservice" then | |
124 | return InternalData["UserInputService"] | |
125 | elseif Service:lower() == "runservice" then | |
126 | return setmetatable({},{ | |
127 | __index = function(self2,Index2) | |
128 | local RealService = RealGame:GetService(Service) | |
129 | local Type2 = type(Index2) | |
130 | if Type2 == "function" then | |
131 | return function (self,...) | |
132 | return RealService[Index2](RealService,...) | |
133 | end | |
134 | else | |
135 | if Index2:lower() == "bindtorenderstep" then | |
136 | return function (self,Name,Priority,Function) | |
137 | return RealGame:GetService("RunService").Stepped:Connect(Function) | |
138 | end | |
139 | end | |
140 | if Index2:lower() == "renderstepped" then | |
141 | return RealService["Stepped"] | |
142 | end | |
143 | return RealService[Index2] | |
144 | end | |
145 | end | |
146 | }) | |
147 | else | |
148 | return RealGame:GetService(Service) | |
149 | end | |
150 | end | |
151 | end | |
152 | return function (self,...) | |
153 | return RealGame[Index](RealGame,...) | |
154 | end | |
155 | else | |
156 | if game:GetService(Index) then | |
157 | return game:GetService(Index) | |
158 | end | |
159 | return RealGame[Index] | |
160 | end | |
161 | else | |
162 | return nil | |
163 | end | |
164 | end | |
165 | });Game = game;owner = game:GetService("Players").LocalPlayer | |
166 | print("Complete! Running... Created by Savangemunkey") | |
167 | ||
168 | ||
169 | ||
170 | script.Name = 'Bruh' | |
171 | wait(.05) | |
172 | local Module_Id = 0 --// Not required, but I use modules somtimes to load union'd models | |
173 | local Player = game:service'Players'.LocalPlayer | |
174 | repeat wait() until Player.Character | |
175 | local Character = Player.Character | |
176 | local Char, Plr = Character, Player | |
177 | local Mouse = Player:GetMouse() | |
178 | local Landed = true | |
179 | local Walking = true | |
180 | ||
181 | --// Settings | |
182 | ||
183 | local CustomClothes = false | |
184 | local Pants, Shirt = 'rbxassetid://99312229','rbxassetid://99312212' | |
185 | local CustomColor = 'Eggplant' | |
186 | local CustomMaterial = 'Slate' | |
187 | local NotifyKeyPresses = false | |
188 | local CanRun = false | |
189 | ||
190 | --// Limbs and what not | |
191 | ||
192 | local Torso = Char:WaitForChild'Torso' | |
193 | local Head = Char:WaitForChild'Head' | |
194 | local Left_Arm = Char:WaitForChild'Left Arm' | |
195 | local Right_Arm = Char:WaitForChild'Right Arm' | |
196 | local Left_Leg = Char:WaitForChild'Left Leg' | |
197 | local Right_Leg = Char:WaitForChild'Right Leg' | |
198 | local HumanoidRootPart = Char:WaitForChild'HumanoidRootPart' | |
199 | local Humanoid = Char:WaitForChild'Humanoid' | |
200 | ||
201 | --// Debounces | |
202 | ||
203 | local DebounceKeyDown, DebounceState = false, false | |
204 | local DebounceAFKAnimations = false | |
205 | ||
206 | --// Other Things | |
207 | ||
208 | local State, LastState, Mode = 'Idle', 'Normal' | |
209 | Mode=LastState | |
210 | local AFKAnimSequenceCount,MaxSequenceCount = 0, 200 | |
211 | ||
212 | --// Abbreiviations | |
213 | ||
214 | local rbx = 'rbxassetid://' | |
215 | local char,Char,plr,Plr = Character, Character, Player, Player | |
216 | local mouse,ms = Mouse, Mouse | |
217 | local cam,camera,Camera,Cam=workspace.CurrentCamera,workspace.CurrentCamera,workspace.CurrentCamera,workspace.CurrentCamera | |
218 | local dkd, debkd = DebounceKeyDown, DebounceKeyDown | |
219 | local dst, debst, ds, debs = DebounceState,DebounceState,DebounceState,DebounceState | |
220 | local daa,dafk,debafk = DebounceAFKAnimations,DebounceAFKAnimations,DebounceAFKAnimations | |
221 | local rs = game:service'RunService' | |
222 | local lrs = rs.Stepped | |
223 | local srs = rs.Heartbeat | |
224 | local lleg,rleg = Left_Leg, Right_Leg | |
225 | local larm,rarm = Left_Arm, Right_Arm | |
226 | local hed,torr,torso = Head, Torso, Torso | |
227 | local hum, root = Humanoid, HumanoidRootPart | |
228 | local vec3,vec2 = Vector3.new, Vector2.new | |
229 | local sin, cos, atan, rad, rand, rands = math.sin, math.cos, math.atan, math.rad, math.random, math.randomseed | |
230 | local cf, ang, eu = CFrame.new, CFrame.Angles, CFrame.fromEulerAnglesXYZ | |
231 | local bc,bcr,c3 = BrickColor.new,BrickColor.Random,Color3.new | |
232 | ||
233 | --// Removals and error prevention | |
234 | ||
235 | if hed:FindFirstChild'Running' then | |
236 | hed:WaitForChild'Running'.Volume = 0 | |
237 | end | |
238 | if Char:FindFirstChild'Animate' then | |
239 | local Anim = Char:WaitForChild'Animate' | |
240 | local Anim_2 = Anim:Clone() | |
241 | Anim_2.Disabled = true | |
242 | Anim_2.Parent = Char | |
243 | Anim.Disabled = true | |
244 | Anim_2.Disabled = false | |
245 | end | |
246 | if Char:FindFirstChild'Health' then | |
247 | ypcall(game.Destroy, Char.Health) | |
248 | end | |
249 | if CustomClothes then | |
250 | if Char:FindFirstChild'Shirt' then | |
251 | Char.Shirt.ShirtTemplate=Shirt | |
252 | else | |
253 | Instance.new('Shirt',Character).ShirtTemplate=Shirt | |
254 | end | |
255 | ||
256 | if Char:FindFirstChild'Pants' then | |
257 | Char.Pants.PantsTemplate=Pants | |
258 | else | |
259 | Instance.new('Pants',Character).PantsTemplate=Pants | |
260 | end | |
261 | end | |
262 | ||
263 | --// Base Functions | |
264 | ||
265 | Weld = function(to, from, c1) | |
266 | local New_Weld = Instance.new('Weld', to) | |
267 | New_Weld.Part0 = from | |
268 | New_Weld.Part1 = to | |
269 | New_Weld.C1 = c1 | |
270 | return New_Weld | |
271 | end | |
272 | ||
273 | clerp = function(c1,c2,al) | |
274 | local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()} | |
275 | local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()} | |
276 | for i,v in pairs(com1) do | |
277 | com1[i] = v+(com2[i]-v)*al | |
278 | end | |
279 | return cf(com1[1],com1[2],com1[3]) * ang(select(4,unpack(com1)))--]] | |
280 | end | |
281 | ||
282 | lerp = function(c1,c2,al) | |
283 | return c1:lerp(c2,al) | |
284 | end | |
285 | ||
286 | snd = function(Id, Parent) | |
287 | local Sound = Instance.new('Sound') | |
288 | Sound.Pitch = 1 | |
289 | Sound.Volume = .5 | |
290 | Sound.Looped = false | |
291 | Sound.SoundId=rbx..Id | |
292 | if Parent:IsA'BasePart' then | |
293 | local p=Instance.new('Part',Character) | |
294 | p.Anchored=true | |
295 | p.Transparency=1 | |
296 | p.CanCollide=false | |
297 | p.Size=vec3(.2,.2,.2) | |
298 | p.CFrame=Parent.CFrame | |
299 | Sound.Parent = p | |
300 | Parent.Changed:connect(function() | |
301 | if Parent.Parent == nil then | |
302 | delay(4,function() | |
303 | p:Destroy() | |
304 | Sound:Destroy() | |
305 | end) | |
306 | end | |
307 | end) | |
308 | else | |
309 | Sound.Parent = Head | |
310 | end | |
311 | return Sound | |
312 | end | |
313 | ||
314 | FacePos = function(pos) | |
315 | local torso, torsoPos = torso, HumanoidRootPart.CFrame.p | |
316 | local torso = Char:FindFirstChild'Torso' | |
317 | if pos == 'mouse' then | |
318 | pos = CFrame.new(torsoPos,Vector3.new(mouse.Hit.X,torsoPos.Y,mouse.Hit.Z)) | |
319 | elseif not pos or pos==nil then | |
320 | pos = CFrame.new(torsoPos,Vector3.new(mouse.Hit.X,torsoPos.Y,mouse.Hit.Z)) | |
321 | else | |
322 | pos = CFrame.new(torsoPos, pos.p) | |
323 | end | |
324 | if torso then | |
325 | HumanoidRootPart.CFrame = lerp(HumanoidRootPart.CFrame,pos,.3) | |
326 | end | |
327 | end | |
328 | ||
329 | local sine, change = 0, 1 | |
330 | ||
331 | --// Model Optional | |
332 | ||
333 | --// Welds | |
334 | ||
335 | local llw = Weld(Left_Leg, Torso, cf(.5,2,0)) | |
336 | local rlw = Weld(Right_Leg, Torso, cf(-.5,2,0)) | |
337 | local raw = Weld(Right_Arm, Torso, cf(-1.5,0,0)) | |
338 | local law = Weld(Left_Arm, Torso, cf(1.5,0,0)) | |
339 | local torw = Weld(Torso, HumanoidRootPart, cf(0,0,0)) | |
340 | local hedw = Weld(Head, Torso, cf(0,-1.5,0)) | |
341 | ||
342 | --[[ State Example: Arms Out | |
343 | raw.C0 = clerp(raw.C0, cf(0,.5,-.5)*ang(rad(90),0,0),.1) | |
344 | law.C0 = clerp(law.C0, cf(0,.5,-.5)*ang(rad(90),0,0),.1) | |
345 | --]] | |
346 | ||
347 | local keyz={}; | |
348 | local Used = { | |
349 | Executed={}; | |
350 | Failed={}; | |
351 | }; | |
352 | ||
353 | local BindKey = function(Name, Key, Function) | |
354 | local keydown | |
355 | keyz[Key:upper()]=Name | |
356 | keydown = mouse.KeyDown:connect(function(key) | |
357 | if Key:lower() == key:lower() then | |
358 | local detect=dkd | |
359 | if dkd then | |
360 | table.insert(Used.Failed, {Name, Key, Function}) | |
361 | elseif not dkd and Walking then | |
362 | if NotifyKeyPresses then | |
363 | warn('executed('..Name..', "'..tostring(Key:upper())..'")') | |
364 | end | |
365 | Function(Name, Key) | |
366 | if NotifyKeyPresses then | |
367 | warn('ended('..Name..')') | |
368 | end | |
369 | table.insert(Used.Executed, {Name, Key, Function}) | |
370 | elseif Walking then | |
371 | warn('You must Walking enabled to use this key') | |
372 | end | |
373 | end | |
374 | end) | |
375 | end | |
376 | ||
377 | local pitches = {} | |
378 | for i = -.1,.1,.01 do table.insert(pitches,1.5+i) end | |
379 | function summonsound() | |
380 | local sfx = {588697230}; | |
381 | local s = snd(sfx[rand(1,#sfx)],root) | |
382 | s.Pitch = pitches[rand(1,#pitches)] | |
383 | game.Debris:AddItem(s,2) | |
384 | s:Play() | |
385 | return s | |
386 | end | |
387 | ||
388 | --[[ | |
389 | ||
390 | BindKey('Attack Name', 'Key{Not case sensative}', function(AttackName, Key) | |
391 | ds,dkd = true,true | |
392 | for i = 0,1,.05 do | |
393 | local animspd = .1 | |
394 | local Right_Arm_ = cf(0,0,0) | |
395 | local Left_Arm_ = cf(0,0,0) | |
396 | local Right_Leg_ = cf(0,0,0) | |
397 | local Left_Leg_ = cf(0,0,0) | |
398 | local Head_ = cf(0,0,0) | |
399 | local Torso_ = cf(0,0,0) | |
400 | ||
401 | torw.C0 = clerp(torw.C0, cf(0,0,0)*Torso_*ang(0,0,0),animspd) | |
402 | hedw.C0 = clerp(hedw.C0, cf(0,0,0)*Head_*ang(0,0,0),animspd) | |
403 | law.C0 = clerp(law.C0, cf(0,0,0)*Left_Arm_*ang(0,0,0),animspd) | |
404 | raw.C0 = clerp(raw.C0, cf(0,0,0)*Right_Arm_*ang(0,0,0),animspd) | |
405 | rlw.C0 = clerp(rlw.C0, cf(0,0,0)*Right_Leg_*ang(0,0,0),animspd) | |
406 | llw.C0 = clerp(llw.C0, cf(0,0,0)*Left_Leg_*ang(0,0,0),animspd) | |
407 | lrs:wait() | |
408 | end | |
409 | for i = 0,1,.05 do | |
410 | local animspd = .1 | |
411 | local Right_Arm_ = cf(0,0,0) | |
412 | local Left_Arm_ = cf(0,0,0) | |
413 | local Right_Leg_ = cf(0,0,0) | |
414 | local Left_Leg_ = cf(0,0,0) | |
415 | local Head_ = cf(0,0,0) | |
416 | local Torso_ = cf(0,0,0) | |
417 | ||
418 | torw.C0 = clerp(torw.C0, cf(0,0,0)*Torso_*ang(0,0,0),animspd) | |
419 | hedw.C0 = clerp(hedw.C0, cf(0,0,0)*Head_*ang(0,0,0),animspd) | |
420 | law.C0 = clerp(law.C0, cf(0,0,0)*Left_Arm_*ang(0,0,0),animspd) | |
421 | raw.C0 = clerp(raw.C0, cf(0,0,0)*Right_Arm_*ang(0,0,0),animspd) | |
422 | rlw.C0 = clerp(rlw.C0, cf(0,0,0)*Right_Leg_*ang(0,0,0),animspd) | |
423 | llw.C0 = clerp(llw.C0, cf(0,0,0)*Left_Leg_*ang(0,0,0),animspd) | |
424 | lrs:wait() | |
425 | end | |
426 | ds,dkd = false,false | |
427 | end) | |
428 | ||
429 | --]] | |
430 | ||
431 | function rainb(hue) | |
432 | local section = hue % 1 * 3 | |
433 | local secondary = 0.5 * math.pi * (section % 1) | |
434 | if section < 1 then | |
435 | return c3(1, 1 - cos(secondary), 1 - sin(secondary)) | |
436 | elseif section < 2 then | |
437 | return c3(1 - sin(secondary), 1, 1 - cos(secondary)) | |
438 | else | |
439 | return c3(1 - cos(secondary), 1 - sin(secondary), 1) | |
440 | end | |
441 | end | |
442 | ||
443 | showDmg = function(To, From, Txt, Others) | |
444 | local bc,c3=BrickColor.new,Color3.new | |
445 | local vec3,cf=Vector3.new,CFrame.new | |
446 | local rand=math.random | |
447 | local n = 2 | |
448 | local lrs=game:service'RunService'.Stepped | |
449 | local Color = CustomColor | |
450 | local Clr_Raw = Color | |
451 | if Clr == nil then Clr = 'Pearl' end | |
452 | Clr = bc(Color).Color | |
453 | local Pert = Instance.new('Part', Character) | |
454 | Pert.Size = vec3(.2,.2,.2) | |
455 | Pert.Transparency = 1 | |
456 | Pert.CanCollide = false | |
457 | Pert.Anchored = true | |
458 | Pert.CFrame = To:FindFirstChild'Head'.CFrame * cf(rand(-n,n),n,rand(-n,n)) | |
459 | Pert.BrickColor = bc('Black') | |
460 | local Rod = nil | |
461 | if (Others.Rod ~= nil and Others.Rod == true) then | |
462 | Rod = Instance.new('Part', Character) | |
463 | local to,from = Pert.CFrame.p, From:WaitForChild'HumanoidRootPart'.CFrame.p | |
464 | local dist = (to-from).magnitude | |
465 | Rod.Size = vec3(.2,.2,dist) | |
466 | Instance.new('BlockMesh',Rod).Scale=vec3(.1,.1,1) | |
467 | Rod.CFrame = cf(to,from)*cf(0,0,-dist/2) | |
468 | Rod.Transparency = .5 or Rod.RodTrans | |
469 | Rod.CanCollide = false | |
470 | Rod.Anchored = true | |
471 | Rod.BrickColor = bc(Clr_Raw) | |
472 | end | |
473 | local Gui = Instance.new('BillboardGui',Pert) | |
474 | Gui.Adornee = Pert | |
475 | local n2 = 10 | |
476 | Gui.Size = UDim2.new(n2,0,n2,0) | |
477 | local TextL = Instance.new('TextLabel', Gui) | |
478 | local r,g,b = Clr.r,Clr.g,Clr.b | |
479 | local clr = c3(r,g,b) | |
480 | TextL.BackgroundTransparency = 1 | |
481 | TextL.Font = 'SciFi' | |
482 | TextL.Size = UDim2.new(1,0,1,0) | |
483 | TextL.TextTransparency = .1 | |
484 | TextL.TextStrokeTransparency = .2 | |
485 | TextL.TextStrokeColor3 = clr | |
486 | TextL.Position = UDim2.new(0,0,0,0) | |
487 | Txt=tostring(Txt):upper() | |
488 | if string.find(Txt:lower(),'critical') or (Others.Crit ~= nil and Others.Crit == true)then | |
489 | Txt='(CRITICAL) // '..Txt | |
490 | end | |
491 | TextL.Text=Txt | |
492 | TextL.TextScaled = false | |
493 | TextL.FontSize = 'Size18' | |
494 | TextL.TextColor3 = Color3.new(1,1,1) | |
495 | local sp = Pert.CFrame*cf(rand(n,n*2),rand(n,n*2),rand(n,n*2)) --Pert.CFrame * cf(rand(-n,n),n,rand(-n,n)) | |
496 | delay(.1,function() | |
497 | repeat lrs:wait() | |
498 | TextL.TextTransparency=TextL.TextTransparency+.005 | |
499 | TextL.TextStrokeTransparency=TextL.TextStrokeTransparency+.005 | |
500 | if Rod ~= nil then | |
501 | Rod.Transparency = Rod.Transparency + .0025 | |
502 | end | |
503 | Pert.CFrame = Pert.CFrame:lerp(sp,.01) | |
504 | clr = c3(r,g,b) | |
505 | if Rod ~= nil then | |
506 | local to,from = Pert.CFrame.p, From:WaitForChild'HumanoidRootPart'.CFrame.p | |
507 | local dist = (to-from).magnitude | |
508 | Rod.Size = vec3(.2,.2,dist) | |
509 | Rod.CFrame = cf(to,from)*cf(0,0,-dist/2) | |
510 | end | |
511 | --TextL.TextColor3 = clr | |
512 | until TextL.TextTransparency>=1 | |
513 | Pert:Destroy() | |
514 | if Rod ~= nil then | |
515 | Rod:Destroy() | |
516 | end | |
517 | end) | |
518 | end | |
519 | ||
520 | --// Example // showDmg(workspace.SavageMunkey, workspace.Base, 'Damage Dealt'..math.random(0,100), {Rod=false,RodTrans=0,Crit=false}) | |
521 | ||
522 | CheckIfLanded = function() | |
523 | local Ray = Ray.new(root.Position,vec3(0,-1,0)*3.5) | |
524 | local Ignore = {Char} | |
525 | local Hit,Pos,SurfaceNorm = workspace:FindPartOnRayWithIgnoreList(Ray,Ignore) | |
526 | if Hit == nil then return false,nil end | |
527 | return true, Hit | |
528 | end; | |
529 | ||
530 | FindNearestTorso = function(Position, Distance, SinglePlayer) | |
531 | if SinglePlayer then return(SinglePlayer.Torso.CFrame.p -Position).magnitude < Distance end | |
532 | local List = {} | |
533 | for i,v in pairs(workspace:GetChildren())do | |
534 | if v:IsA("Model")then | |
535 | if v:findFirstChild("Torso")then | |
536 | if v ~= Char then | |
537 | if(v.Torso.Position -Position).magnitude <= Distance then | |
538 | table.insert(List,v) | |
539 | end | |
540 | end | |
541 | end | |
542 | end | |
543 | end | |
544 | return List | |
545 | end | |
546 | ||
547 | DebounceHit = false | |
548 | ||
549 | NewFXBox = function(name,prnt) | |
550 | if prnt == nil then | |
551 | prnt = Character | |
552 | end | |
553 | local FXBox = Instance.new('Model', prnt) | |
554 | FXBox.Name = 'FXBox' | |
555 | if name then | |
556 | FXBox.Name = name | |
557 | end | |
558 | local Count = 0 | |
559 | local Check | |
560 | Check = FXBox.ChildAdded:connect(function(Object) | |
561 | if Object:IsA'BasePart' then | |
562 | FXBox.PrimaryPart = Object | |
563 | Check:disconnect() | |
564 | end | |
565 | end) | |
566 | return FXBox | |
567 | end | |
568 | ||
569 | ReSurface = function(Part, Integer) | |
570 | if Part ~= nil and Part:IsA'BasePart' then | |
571 | Part.TopSurface = Integer | |
572 | Part.BottomSurface = Integer | |
573 | Part.LeftSurface = Integer | |
574 | Part.RightSurface = Integer | |
575 | Part.FrontSurface = Integer | |
576 | Part.BackSurface = Integer | |
577 | end | |
578 | end | |
579 | ||
580 | function ni(name,prnt) | |
581 | return Instance.new(tostring(name),prnt) | |
582 | end | |
583 | ||
584 | local FX = NewFXBox('FXBox', Character) | |
585 | function NewObject(Type, prnt, others) | |
586 | if not prnt then prnt = workspace end | |
587 | local New = ni(Type) | |
588 | if New:IsA'BasePart' then | |
589 | ReSurface(New,10) | |
590 | New.Anchored = true | |
591 | New.Size = vec3(1,1,1) | |
592 | New.CanCollide = false | |
593 | end | |
594 | for i,v in next, others do | |
595 | local suc,err = pcall(function() | |
596 | New[i] = v | |
597 | end) | |
598 | if not suc then | |
599 | print(err) | |
600 | end | |
601 | end | |
602 | New.Parent = prnt | |
603 | return New | |
604 | end | |
605 | ||
606 | function OnHumanoidFind(Detector, Offset, Function, Range, Multi) --// R15 Support | |
607 | spawn(function() | |
608 | if not Multi then Multi = false end | |
609 | local PlayerModels={}; | |
610 | local SearchAndStuff | |
611 | local First = true | |
612 | SearchAndStuff=function(Parent) | |
613 | for Index, Obj in next, Parent:children() do | |
614 | if Obj:IsA'Model' and Obj:FindFirstChild'Humanoid' then | |
615 | if Obj:FindFirstChild'HumanoidRootPart' and (Obj.HumanoidRootPart.CFrame.p-(Detector.CFrame*Offset).p).magnitude <= Range and Obj~=char then | |
616 | --print'derp' | |
617 | table.insert(PlayerModels, Obj) | |
618 | if First then | |
619 | if not Multi then | |
620 | First = false | |
621 | end | |
622 | pcall(function() | |
623 | Obj.Health.Disabled = true | |
624 | end) | |
625 | spawn(function() | |
626 | Function(Obj:WaitForChild'HumanoidRootPart', Obj:WaitForChild'Humanoid', Obj) | |
627 | end) | |
628 | end | |
629 | end | |
630 | end | |
631 | SearchAndStuff(Obj) | |
632 | end | |
633 | end | |
634 | SearchAndStuff(workspace) | |
635 | return PlayerModels | |
636 | end) | |
637 | end | |
638 | ||
639 | function debri(item,time) | |
640 | return game:service'Debris':AddItem(item,time) | |
641 | end | |
642 | ||
643 | local effects={MagicCircles={};}; | |
644 | local trans={}; | |
645 | local grows={} | |
646 | ||
647 | function effects:MagicCircle(waitt, id, Offset) | |
648 | local mcPart=NewObject('Part', FX,{Transparency=1,Size=vec3(4.5,4.5,.2)}) | |
649 | debri(mcPart,40) | |
650 | local mesh=NewObject('BlockMesh',mcPart,{Scale=vec3(1,1,0)}) | |
651 | summonsound() | |
652 | local backDecal=NewObject('Decal',mcPart,{Color3=bc(CustomColor).Color,Face='Back',Texture=rbx..id}) | |
653 | local frontDecal=NewObject('Decal',mcPart,{Color3=bc(CustomColor).Color,Face='Front',Texture=rbx..id}) | |
654 | local r=rand() | |
655 | local dir=5 | |
656 | if r>.5 then dir=-5 end | |
657 | spawn(function() | |
658 | repeat wait() until frontDecal.Parent==nil mcPart:Destroy() | |
659 | end) | |
660 | table.insert(effects.MagicCircles, {mcPart,backDecal,frontDecal,dir}) | |
661 | mcPart.CFrame = Offset | |
662 | delay(waitt,function() trans[backDecal]={.05,1} trans[frontDecal]={.05,1}end) | |
663 | return mcPart | |
664 | end | |
665 | ||
666 | function effects:particle(waitt,mx,num, shape,Offset, clrz,cancollide) | |
667 | local sz={}; | |
668 | if not clrz or #clrz < 1 then | |
669 | clrz={'Royal purple','Pearl',CustomColor} | |
670 | end | |
671 | for i = .4,mx,.025 do table.insert(sz,i) end | |
672 | local tings={}; | |
673 | for i = 1,num do | |
674 | local val = sz[rand(1,#sz)] | |
675 | local part=NewObject('Part', FX,{Material=CustomMaterial, CanCollide=cancollide,Shape=shape, Transparency=.6,Size=vec3(val,val,val),Color = bc(clrz[rand(1,#clrz)]).Color, CFrame = Offset*ang(rad(rand(-360,360)),rad(rand(-360,360)),rad(rand(-360,360)))}) | |
676 | tings[i]=part | |
677 | delay(waitt,function() trans[part]={.05,1} end) | |
678 | end | |
679 | return tings | |
680 | end | |
681 | ||
682 | function effects:Debris(cancollide, radius, mx, num, pos, waitt,velocitymax) | |
683 | local Ray = Ray.new(pos+vec3(0,1,0),vec3(0,-1,0)*5) | |
684 | local Ignore = {FX,Character} | |
685 | local Hit, Pos, SurfaceNorm = workspace:FindPartOnRayWithIgnoreList(Ray,Ignore) | |
686 | local tings={}; | |
687 | if Hit then | |
688 | local sz={}; | |
689 | for i = .2,mx,.025 do table.insert(sz,i) end | |
690 | for i = 1,num do | |
691 | local val = sz[rand(1,#sz)] | |
692 | local y = 45 | |
693 | if not cancollide then y = 65 end | |
694 | local top,bottom=velocitymax[1],velocitymax[2] | |
695 | local x,z=rand(bottom,top),rand(bottom,top) | |
696 | local part=NewObject('Part', FX,{Anchored=false, Velocity = vec3(rand(-x,x),y,rand(-z,z)), Material=Hit.Material, CanCollide=cancollide, Transparency=Hit.Transparency,Size=vec3(val,val,val),Color = Hit.Color, CFrame = cf(pos)*cf(rand(-radius,radius),0,rand(-radius,radius))*ang(rad(rand(-360,360)),rad(rand(-360,360)),rad(rand(-360,360)))}) | |
697 | tings[i]=part | |
698 | if cancollide then | |
699 | delay(waitt,function() trans[part]={.05,1} end) | |
700 | end | |
701 | end | |
702 | return tings | |
703 | else | |
704 | --// Derp | |
705 | end | |
706 | end | |
707 | ||
708 | function effects:BlastRad(cancollide, radius, num, mx, pos, waitt) | |
709 | local Ray = Ray.new(pos+vec3(0,1,0),vec3(0,-1,0)*5) | |
710 | local Ignore = {FX,Character} | |
711 | local Hit, Pos, SurfaceNorm = workspace:FindPartOnRayWithIgnoreList(Ray,Ignore) | |
712 | local tings={}; | |
713 | local org=mx/4 | |
714 | mx=mx | |
715 | if Hit then | |
716 | local sz={}; | |
717 | for i = .2,num,.025 do table.insert(sz,i) end | |
718 | for i = 1,360,mx do | |
719 | local val = sz[rand(1,#sz)] | |
720 | local function rr() | |
721 | local vlz={} | |
722 | for i = .45,1,.025 do table.insert(vlz,i) end | |
723 | return vlz[rand(1,#vlz)] | |
724 | end | |
725 | local part=NewObject('Part', FX,{Material=Hit.Material, CanCollide=cancollide, Transparency=Hit.Transparency,Size=vec3(val/rr(),val/rr(),val/rr()),Color = Hit.Color, CFrame = cf(pos) * ang(0,rad(i),0)*cf(radius,(Hit.CFrame.Y+(Hit.Size.Y/2))-val,0)*ang(rad(rand(-360,360)),rad(rand(-360,360)),rad(rand(-360,360)))}) | |
726 | tings[i]=part | |
727 | if cancollide then | |
728 | delay(waitt,function() trans[part]={.05,1} end) | |
729 | end | |
730 | end | |
731 | return tings | |
732 | else | |
733 | --// Derp | |
734 | end | |
735 | end | |
736 | ||
737 | --[[ examples | |
738 | effects:BlastRad(true, 15, 2, 18, pos, .5) | |
739 | ||
740 | effects:Debris(true, 2.5, 2, rand(10,20), pos, .5,{50,25}) | |
741 | ||
742 | effects:MagicCircle(.15,124339738, cf(0,-1.5,0)) | |
743 | ||
744 | effects:particle(.5,1.2,rand(2,5),'Ball',cf(0,-1.5,0),{CustomColor,'Pearl'}) | |
745 | --]] | |
746 | ||
747 | BindKey('Ion Beam', 'e', function(AttackName, Key) | |
748 | ds,dkd = true,true | |
749 | for i = 0,1,.05 do | |
750 | FacePos'mouse' | |
751 | local animspd = .5 | |
752 | Right_Arm_ = CFrame.new(1.63944244, -1.00000119, -0.438468933, 0, -0.866025388, 0.500000238, 1, 0, 0, 0, 0.500000238, 0.866025388) | |
753 | Left_Arm_ = CFrame.new(-0.21706295, -0.303030014, -0.0192867965, 0.939692855, 0.342019916, -2.08616257e-007, -0.342019856, 0.939692736, 1.5155652e-007, 2.08616257e-007, -8.94069672e-008, 1.00000024) | |
754 | Right_Leg_ = CFrame.new(0.0669910312, 0, -0.249992311, 0.866025567, 0, -0.499999881, 0, 1, 0, 0.499999881, 0, 0.866025567) | |
755 | Left_Leg_ = CFrame.new(-3.69548798e-006, 0, -7.62939453e-006, 1.00000024, 0, 0, 0, 1, 0, 0, 0, 1.00000024) | |
756 | Head_ = CFrame.new(0, 0, 0, 0.500000238, 0, -0.866025388, 0, 1, 0, 0.866025388, 0, 0.500000238) | |
757 | Torso_ = CFrame.new(-0.349983215, 0, 0, 0.500000238, 0, 0.866025388, 0, 1, 0, -0.866025388, 0, 0.500000238) | |
758 | ||
759 | torw.C0 = clerp(torw.C0, cf(0,0,0)*Torso_*ang(0,0,0),animspd) | |
760 | hedw.C0 = clerp(hedw.C0, cf(0,0,0)*Head_*ang(0,0,0),animspd) | |
761 | law.C0 = clerp(law.C0, cf(0,0,0)*Left_Arm_*ang(0,0,0),animspd) | |
762 | raw.C0 = clerp(raw.C0, cf(0,0,0)*Right_Arm_*ang(0,0,0),animspd) | |
763 | rlw.C0 = clerp(rlw.C0, cf(0,0,0)*Right_Leg_*ang(0,0,0),animspd) | |
764 | llw.C0 = clerp(llw.C0, cf(0,0,0)*Left_Leg_*ang(0,0,0),animspd) | |
765 | lrs:wait() | |
766 | end | |
767 | local mc=effects:MagicCircle(.15,127817121, rarm.CFrame * cf(0,-1.5,0)*ang(rad(90),0,0)) | |
768 | local particles = effects:particle(.5,1.2,rand(2,5),'Ball',rarm.CFrame*cf(0,-1.5,0),{CustomColor,'Pearl'}) | |
769 | spawn(function() | |
770 | local start=(rarm.CFrame*cf(0,-1.65,0)) | |
771 | local endp = mouse.Hit.p | |
772 | local dir = cf(start.p,endp) | |
773 | local dist | |
774 | local beam = NewObject('Part',FX,{Material=CustomMaterial,Size = vec3(1,1,1), Transparency=.5,BrickColor=bcCustomColor,CFrame=dir*start}) | |
775 | local i,maxi,up=0,800,15 | |
776 | while i<maxi and lrs:wait() do | |
777 | if beam.Transparency >= 1 then | |
778 | beam:Destroy() | |
779 | break | |
780 | end | |
781 | i=i+up | |
782 | beam.Transparency=beam.Transparency+(1/(maxi/up)) | |
783 | local bcf=(beam.CFrame*cf(0,0,-(i/2))) | |
784 | local Ray = Ray.new(start.p,(start.p-(cf(start.p,endp)*cf(0,0,1)).p).unit*i) | |
785 | local Hit,Pos,SurfaceNorm = workspace:FindPartOnRayWithIgnoreList(Ray,{Char,FX}) | |
786 | if Hit then | |
787 | local particles = effects:particle(.001,6,rand(3,7),'Block',cf(Pos),{'Pearl',CustomColor}) | |
788 | spawn(function() | |
789 | table.insert(grows,{particles,.5}) | |
790 | end) | |
791 | local hsnd=snd(233856130,particles[1]) | |
792 | hsnd.Volume=4 | |
793 | hsnd.Pitch=pitches[rand(1,#pitches)] | |
794 | hsnd:Play() | |
795 | local hsnd2=snd(471882019,particles[1]) | |
796 | hsnd2.Volume=4 | |
797 | hsnd2.Pitch=pitches[rand(1,#pitches)] | |
798 | hsnd2:Play() | |
799 | effects:Debris(true, 2.5, 2, rand(10,20), Pos, .5,{50,25}) | |
800 | effects:BlastRad(true, 3, 2, 18, Pos, .5) | |
801 | OnHumanoidFind(particles[1], cf(0,0,0), function(rootp,human,model) | |
802 | local Hum = human | |
803 | local dmg=rand(17,25) | |
804 | Hum.Health = Hum.Health - dmg | |
805 | local num=rand() | |
806 | local derp=false | |
807 | if num>.45 then | |
808 | derp=true | |
809 | dmg=dmg | |
810 | Hum.PlatformStand = true | |
811 | end | |
812 | showDmg(Hum.Parent, Character, dmg, {Rod=true,RodTrans=0,Crit=derp}) | |
813 | end, 15, true) | |
814 | break | |
815 | else | |
816 | beam.Size=beam.Size:lerp(vec3(1,1,i),.5) | |
817 | beam.CFrame = dir*cf(0,0,-i/2)*ang(0,0,rad(i)) --// cf((beam.CFrame*cf(0,0,-i/2)).p,(beam.CFrame*cf(0,0,-(i/2)+4)).p) | |
818 | end | |
819 | lrs:wait() | |
820 | end | |
821 | beam:Destroy() | |
822 | ||
823 | end) | |
824 | ds,dkd = false,false | |
825 | end) | |
826 | ||
827 | BindKey('Spike Barrage Rise', 'q', function(AttackName, Key) | |
828 | ds,dkd = true,true | |
829 | for i = 0,1,.05 do | |
830 | FacePos'mouse' | |
831 | local animspd = .4 | |
832 | Right_Arm_ = CFrame.new(0.370960236, 0.770703673, -1.29712296, 0.866025269, -0.500000298, 1.35973167e-007, -0.0950751901, -0.164675236, -0.981755078, 0.490877777, 0.850224674, -0.190150529) | |
833 | Left_Arm_ = CFrame.new(-0.370960236, 0.770703673, -1.2971077, 0.866025269, 0.500000298, -1.35973167e-007, 0.0950751901, -0.164675236, -0.981755078, -0.490877777, 0.850224674, -0.190150529) | |
834 | Right_Leg_ = CFrame.new(0, 0.117139697, -0.42620942, 1, 0, 0, 0, 0.990105569, -0.140325084, 0, 0.140325084, 0.990105569) | |
835 | Left_Leg_ = CFrame.new(0, 0.00440132618, -0.339604199, 1, 0, 0, 0, 0.992687285, 0.120714575, 0, -0.120714575, 0.992687285) | |
836 | Head_ = CFrame.new(0, 0.0041718483, -0.112817012, 1, 0, 0, 0, 0.997167885, -0.0752087981, 0, 0.0752087981, 0.997167885) | |
837 | Torso_ = CFrame.new(0, -0.0968499184, -0.0671653748, 1, 0, 0, 0, 0.990105569, 0.140325084, 0, -0.140325084, 0.990105569) | |
838 | ||
839 | torw.C0 = clerp(torw.C0, cf(0,0,0)*Torso_*ang(0,0,0),animspd) | |
840 | hedw.C0 = clerp(hedw.C0, cf(0,0,0)*Head_*ang(0,0,0),animspd) | |
841 | law.C0 = clerp(law.C0, cf(0,0,0)*Left_Arm_*ang(0,0,0),animspd) | |
842 | raw.C0 = clerp(raw.C0, cf(0,0,0)*Right_Arm_*ang(0,0,0),animspd) | |
843 | rlw.C0 = clerp(rlw.C0, cf(0,0,0)*Right_Leg_*ang(0,0,0),animspd) | |
844 | llw.C0 = clerp(llw.C0, cf(0,0,0)*Left_Leg_*ang(0,0,0),animspd) | |
845 | lrs:wait() | |
846 | end | |
847 | local pos | |
848 | hum.WalkSpeed=0 | |
849 | hum.JumpPower=0 | |
850 | for i = 0,1,.05 do | |
851 | local animspd = .4 | |
852 | Right_Arm_ = CFrame.new(0, 1.00624561, -0.619987488, 1, 0, 0, 0, -0.655552566, -0.755149782, 0, 0.755149782, -0.655552566) | |
853 | Left_Arm_ = CFrame.new(0, 1.00623989, -0.619972229, 1, 0, 0, 0, -0.655552566, -0.755149782, 0, 0.755149782, -0.655552566) | |
854 | Right_Leg_ = CFrame.new(0, 0.0947320461, -0.297110081, 1, 0, 0, 0, 0.981755137, -0.190150023, 0, 0.190150023, 0.981755137) | |
855 | Left_Leg_ = CFrame.new(0, -0.0276720524, -0.331606507, 1, 0, 0, 0, 0.986158729, 0.165805161, 0, -0.165805161, 0.986158729) | |
856 | Head_ = CFrame.new(0, 0.00417375565, -0.112819031, 1, 0, 0, 0, 0.997167945, -0.0752075911, 0, 0.0752075985, 0.997167945) | |
857 | Torso_ = CFrame.new(0, -0.0691239834, -0.0950775146, 1, 0, 0, 0, 0.981755137, 0.190150023, 0, -0.190150023, 0.981755137) | |
858 | ||
859 | torw.C0 = clerp(torw.C0, cf(0,0,0)*Torso_*ang(0,0,0),animspd) | |
860 | hedw.C0 = clerp(hedw.C0, cf(0,0,0)*Head_*ang(0,0,0),animspd) | |
861 | law.C0 = clerp(law.C0, cf(0,0,0)*Left_Arm_*ang(0,0,0),animspd) | |
862 | raw.C0 = clerp(raw.C0, cf(0,0,0)*Right_Arm_*ang(0,0,0),animspd) | |
863 | rlw.C0 = clerp(rlw.C0, cf(0,0,0)*Right_Leg_*ang(0,0,0),animspd) | |
864 | llw.C0 = clerp(llw.C0, cf(0,0,0)*Left_Leg_*ang(0,0,0),animspd) | |
865 | lrs:wait() | |
866 | end | |
867 | ds,dkd = false,false | |
868 | end) | |
869 | ||
870 | local mh = 1500 | |
871 | hum.MaxHealth = mh | |
872 | wait(.1) | |
873 | hum.Health = mh | |
874 | HumanoidRootPart.Transparency = .9 | |
875 | ||
876 | local debvals={}; | |
877 | debvals['CLEAN']=0 | |
878 | debvals['walkparticles']=0 | |
879 | local Handle = function() | |
880 | spawn(function() | |
881 | for i,v in next, effects.MagicCircles do | |
882 | if v[1].Parent ~= nil then | |
883 | v[1].CFrame = lerp(v[1].CFrame, v[1].CFrame * CFrame.Angles(0,0,rad(v[4])), .9) | |
884 | else | |
885 | --table.remove(effects.MagicCircles,i) | |
886 | effects.MagicCircles[i]=nil | |
887 | end | |
888 | end | |
889 | end) | |
890 | spawn(function() | |
891 | for ting,data in next, trans do | |
892 | if ting.Transparency~=nil and ting.Transparency < data[2] then | |
893 | --print(ting.Transparency,data[2]) | |
894 | ting.Transparency=ting.Transparency+data[1] | |
895 | elseif ting.Transparency >= tonumber(data[2]) and ting.Parent ~= nil then | |
896 | --print'ded' | |
897 | trans[ting]=nil | |
898 | ting:Destroy() | |
899 | end | |
900 | end | |
901 | end) | |
902 | spawn(function() | |
903 | for a,b in next, grows do | |
904 | if a==grows[15] then | |
905 | grows={}; | |
906 | for i,v in next, grows do | |
907 | grows[i]=v | |
908 | end | |
909 | print'ded' | |
910 | else | |
911 | if #b > 1 then | |
912 | for __,v in next, b[1] do | |
913 | if v.Parent ~= nil then | |
914 | if v.Transparency > 8 then | |
915 | v:Destroy() | |
916 | else | |
917 | local c=v.CFrame | |
918 | v.Size=v.Size+vec3(b[2],b[2],b[2]) | |
919 | v.CFrame=c*ang(rad(2),rad(2/2),rad(2*3)) | |
920 | end | |
921 | else | |
922 | b[1][__]=nil | |
923 | end | |
924 | end | |
925 | else | |
926 | grows[a]=nil | |
927 | end | |
928 | end | |
929 | end | |
930 | end) | |
931 | if not Walking and debvals['walkparticles']>.09 then | |
932 | debvals['walkparticles']=0 | |
933 | local particles = effects:particle(.1,2.2,1,'Block',torso.CFrame,{CustomColor,'Pearl'}) | |
934 | table.insert(grows,{particles,.5}) | |
935 | else | |
936 | --print(debvals['walkparticles']) | |
937 | end | |
938 | if debvals['CLEAN'] > 40 then | |
939 | debvals['CLEAN']=0 | |
940 | grows={}; | |
941 | trans={}; | |
942 | effects.MagicCircles={}; | |
943 | FX:ClearAllChildren() | |
944 | end | |
945 | for i,v in next,debvals do | |
946 | debvals[i]=v+.1 | |
947 | --print(i,v) | |
948 | end | |
949 | end | |
950 | ||
951 | Mouse.KeyDown:connect(function(Key) | |
952 | if Key:byte() == 48 then | |
953 | Walking = false | |
954 | end | |
955 | end) | |
956 | ||
957 | Mouse.KeyUp:connect(function(Key) | |
958 | if Key:byte() == 48 then | |
959 | Walking = true | |
960 | end | |
961 | end) | |
962 | ||
963 | local upv=0 | |
964 | lrs:connect(function() | |
965 | Handle() | |
966 | Landed = CheckIfLanded() | |
967 | sine = sine+change/2 | |
968 | hum.PlatformStand = false | |
969 | if ds then | |
970 | return | |
971 | end | |
972 | hum.JumpPower = 150 | |
973 | hum.WalkSpeed = 9 | |
974 | if Walking then | |
975 | hum.WalkSpeed=12 | |
976 | else | |
977 | hum.WalkSpeed = 48 | |
978 | end | |
979 | local tmag_xz = (torso.Velocity*vec3(1, 0, 1)).magnitude | |
980 | local tmag_y = torso.Velocity.Y | |
981 | local trot = torso.RotVelocity.Y/50 | |
982 | local speed = Vector3.new(Torso.Velocity.X,0,Torso.Velocity.Z) | |
983 | local TiltOnAxis = (root.CFrame-root.CFrame.p):inverse()*speed/200 | |
984 | local Tilt = ang(TiltOnAxis.Z,-TiltOnAxis.X,-TiltOnAxis.X) | |
985 | if Landed == false then | |
986 | State, Mode = 'Falling', 'Normal' | |
987 | elseif tmag_xz < 7 then | |
988 | State, Mode = 'Idle', 'Normal' | |
989 | elseif tmag_xz >= 10 then | |
990 | State = 'Walking' | |
991 | if tmag_xz > 23 then | |
992 | Mode = 'Running' | |
993 | else | |
994 | Mode = 'Normal' | |
995 | end | |
996 | end | |
997 | local RestoreDefault = function(Current) | |
998 | Current = Current or State | |
999 | if LastState ~= Current then | |
1000 | LastState = Current | |
1001 | sine = 0 | |
1002 | end | |
1003 | end | |
1004 | local Default_Anims = function() | |
1005 | local animspd = .1 | |
1006 | local Right_Arm_ = cf(0,0,0) | |
1007 | local Left_Arm_ = cf(0,0,0) | |
1008 | local Right_Leg_ = cf(0,0,0) | |
1009 | local Left_Leg_ = cf(0,0,0) | |
1010 | local Head_ = cf(0,0,0) | |
1011 | local Torso_ = cf(0,0,0) | |
1012 | ||
1013 | torw.C0 = clerp(torw.C0, cf(0,0,0)*Torso_*ang(0,0,0),animspd) | |
1014 | hedw.C0 = clerp(hedw.C0, cf(0,0,0)*Head_*ang(0,0,0),animspd) | |
1015 | law.C0 = clerp(law.C0, cf(0,0,0)*Left_Arm_*ang(0,0,0),animspd) | |
1016 | raw.C0 = clerp(raw.C0, cf(0,0,0)*Right_Arm_*ang(0,0,0),animspd) | |
1017 | rlw.C0 = clerp(rlw.C0, cf(0,0,0)*Right_Leg_*ang(0,0,0),animspd) | |
1018 | llw.C0 = clerp(llw.C0, cf(0,0,0)*Left_Leg_*ang(0,0,0),animspd) | |
1019 | end | |
1020 | if State == 'Falling' and ds == false then | |
1021 | local animspd = .3 | |
1022 | change=1 | |
1023 | Right_Arm_ = CFrame.new(0.309095025, -0.285505116, -0.0270642117, 0.920238733, -0.384522766, -0.0728211105, 0.386343509, 0.922273397, 0.0122654885, 0.0624446124, -0.0394211262, 0.99726963) | |
1024 | Left_Arm_ = CFrame.new(-0.340406179, -0.299129426, 0.0357903093, 0.920238614, 0.384522349, -0.0728249624, -0.384691834, 0.922963858, 0.0122471973, 0.0719241202, 0.0167448297, 0.99726963) | |
1025 | Right_Leg_ = CFrame.new(-6.10351563e-005, 3.81469727e-005, -1.90734863e-006, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
1026 | Left_Leg_ = CFrame.new(-6.10351563e-005, 0.361884952, -0.74763912, 1, 0, 0, 0, 0.965925157, 0.258821696, 0, -0.258821696, 0.965925157) | |
1027 | Head_ = CFrame.new(0, 0.200837851, 0.559991479, 1, 0, 0, 0, 0.866024137, 0.500002325, 0, -0.500002325, 0.866024137) | |
1028 | Torso_ = CFrame.new(0, 0.0190048218, 0.0427560806, 1, 0, 0, 0, 0.992914736, -0.118828967, 0, 0.118828967, 0.992914736) | |
1029 | ||
1030 | torw.C0 = clerp(torw.C0, cf(-sin(sine/rand(2,8))/15,sin(sine/rand(2,8))/15,0)*Torso_*ang(0,0,0),animspd) | |
1031 | hedw.C0 = clerp(hedw.C0, cf(0,0,0)*Head_*ang(0,0,0),animspd) | |
1032 | law.C0 = lerp(law.C0, cf(0,0,0)*Left_Arm_*ang(0,0,0),animspd) | |
1033 | raw.C0 = lerp(raw.C0, cf(0,0,0)*Right_Arm_*ang(0,0,0),animspd) | |
1034 | rlw.C0 = clerp(rlw.C0, cf(0,0,0)*Right_Leg_*ang(0,0,0),animspd) | |
1035 | llw.C0 = clerp(llw.C0, cf(0,0,0)*Left_Leg_*ang(0,0,0),animspd) | |
1036 | elseif State == 'Idle' and ds == false then | |
1037 | RestoreDefault() | |
1038 | if Mode == 'Normal' and ds == false then | |
1039 | local animspd = .2 | |
1040 | change=1 | |
1041 | torw.C0 = lerp(torw.C0, cf(0,-sin(sine/6)/15,.1-sin(sine/6)/41)*CFrame.new(0, 0, 0, 0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994)*ang(-rad(5)+sin(sine/6)/41,-rad(16),0),animspd) | |
1042 | hedw.C0 = clerp(hedw.C0, cf(0,0,-cos(sine/6)/24)*CFrame.new(0.0443366542, 0.0183815956, 0.154620528, 0.965866625, -0.0431191772, 0.25542587, 0.00273020566, 0.987688363, 0.15641053, -0.259025425, -0.150374338, 0.95409292)*ang(cos(sine/6)/24,0,0),animspd) | |
1043 | law.C0 = clerp(law.C0, cf(-cos(sine/6)/24,0,0)*CFrame.new(-0.17305398, -0.4023332, -0.290585816, 0.933187842, 0.329444826, -0.143619344, -0.358558774, 0.826312661, -0.434330463, -0.0244134665, 0.456807911, 0.889230251)*ang(0,0,-cos(sine/6)/15),animspd) | |
1044 | raw.C0 = clerp(raw.C0, cf(cos(sine/6)/24,0,0)*CFrame.new(0.352661252, -0.465409994, 0, 0.866025329, -0.49999997, 0, 0.5, 0.866025388, 0, 0, 0, 0.99999994)*ang(0,0,cos(sine/6)/15),animspd) | |
1045 | rlw.C0 = clerp(rlw.C0, cf(sin(sine/6)/41,sin(sine/6)/15,-.1+sin(sine/6)/41)*CFrame.new(-0.148569882, -0.0734579563, 0.0426014438, 0.993112504, -0.117148325, 0.0019749701, 0.117148332, 0.992546141, -0.0335917622, 0.0019749403, 0.0335917659, 0.999433637)*ang(-sin(sine/6)/41,0,0),animspd) | |
1046 | llw.C0 = clerp(llw.C0, cf(sin(sine/6)/41,sin(sine/6)/15,-.1+sin(sine/6)/41)*CFrame.new(0.18119061, -0.113829255, -0.0519562438, 0.985961914, 0.166921332, 0.00402534008, -0.166921332, 0.98480773, 0.0478639491, 0.00402531028, -0.0478639565, 0.998845637)*ang(-sin(sine/6)/41,0,0),animspd) | |
1047 | else | |
1048 | Default_Anims() | |
1049 | warn'Idle: Unknown Mode Used' | |
1050 | end | |
1051 | elseif State == 'Walking' and ds == false then | |
1052 | RestoreDefault() | |
1053 | if Mode == 'Normal' and ds == false then | |
1054 | local animspd = .225 | |
1055 | local Right_Arm_ = cf(0,0,0) | |
1056 | local Left_Arm_ = cf(0,0,0) | |
1057 | local Right_Leg_ = cf(0,0,0) | |
1058 | local Left_Leg_ = cf(0,0,0) | |
1059 | local Head_ = cf(0,0,0) | |
1060 | local Torso_ = cf(0,0,0) | |
1061 | ||
1062 | local animspd = .2 | |
1063 | change=1.55 | |
1064 | torw.C0 = lerp(torw.C0, cf(0,cos(sine/3)/8,0)*ang(-rad(10)+cos(sine/3)/8,cos(sine/6)/8,0),animspd) | |
1065 | hedw.C0 = clerp(hedw.C0, cf(0,0,-.2+cos(sine/3)/8)*ang(rad(10)+-cos(sine/3)/8,trot+-cos(sine/6)/8,0),animspd) | |
1066 | law.C0 = clerp(law.C0, cf(0,0,-cos(sine/6)/2)*CFrame.new(-0.201123714, -0.238223612, 0, 0.965925872, 0.258818984, 0, -0.258818984, 0.965925872, 0, 0, 0, 1)*ang(cos(sine/6)/2,0,0),animspd) | |
1067 | raw.C0 = clerp(raw.C0, cf(0,0,cos(sine/6)/2)*CFrame.new(0.201123714, -0.238223612, 0, 0.965925872, -0.258818984, 0, -0.258818984, 0.965925872, 0, 0, 0, 1)*ang(-cos(sine/6)/2,0,0),animspd) | |
1068 | rlw.C0 = clerp(rlw.C0, cf(-.034,-sin(sine/6)/4,-.4+-cos(sine/6)/2+sin(sine/6)/2)*ang(-rad(5)+sin(sine/6)/3,-cos(sine/6)/8,rad(2)),animspd) | |
1069 | llw.C0 = clerp(llw.C0, cf(.0340,sin(sine/6)/4,-.4+cos(sine/6)/2+-sin(sine/6)/2)*ang(-rad(5)+-sin(sine/6)/3,-cos(sine/6)/8,-rad(2)),animspd) | |
1070 | elseif Mode == 'Running' and ds == false then | |
1071 | local animspd = .1 | |
1072 | local Right_Arm_ = cf(0,0,0) | |
1073 | local Left_Arm_ = cf(0,0,0) | |
1074 | local Right_Leg_ = cf(0,0,0) | |
1075 | local Left_Leg_ = cf(0,0,0) | |
1076 | local Head_ = cf(0,0,0) | |
1077 | local Torso_ = cf(0,0,0) | |
1078 | upv=upv+25 | |
1079 | torw.C0 = lerp(torw.C0, cf(cos(sine/3)/8,sin(sine/6)/5,trot)*Torso_*ang(-rad(90),rad(upv),0),.3) | |
1080 | hedw.C0 = clerp(hedw.C0, cf(0,0,0)*Head_*ang(0,0,0),animspd) | |
1081 | law.C0 = clerp(law.C0, cf(0,0,0)*Left_Arm_*ang(0,0,0),animspd) | |
1082 | raw.C0 = clerp(raw.C0, cf(0,0,0)*Right_Arm_*ang(0,0,0),animspd) | |
1083 | rlw.C0 = clerp(rlw.C0, cf(0,0,0)*Right_Leg_*ang(0,0,0),animspd) | |
1084 | llw.C0 = clerp(llw.C0, cf(0,0,0)*Left_Leg_*ang(0,0,0),animspd) | |
1085 | else | |
1086 | Default_Anims() | |
1087 | warn'Walking: Unknown Mode Used' | |
1088 | end | |
1089 | else --// New Animation Test Stage | |
1090 | local animspd = .1 | |
1091 | local Right_Arm_ = cf(0,0,0) | |
1092 | local Left_Arm_ = cf(0,0,0) | |
1093 | local Right_Leg_ = cf(0,0,0) | |
1094 | local Left_Leg_ = cf(0,0,0) | |
1095 | local Head_ = cf(0,0,0) | |
1096 | local Torso_ = cf(0,0,0) | |
1097 | ||
1098 | torw.C0 = clerp(torw.C0, cf(0,0,0)*Torso_*ang(0,0,0),animspd) | |
1099 | hedw.C0 = clerp(hedw.C0, cf(0,0,0)*Head_*ang(0,0,0),animspd) | |
1100 | law.C0 = clerp(law.C0, cf(0,0,0)*Left_Arm_*ang(0,0,0),animspd) | |
1101 | raw.C0 = clerp(raw.C0, cf(0,0,0)*Right_Arm_*ang(0,0,0),animspd) | |
1102 | rlw.C0 = clerp(rlw.C0, cf(0,0,0)*Right_Leg_*ang(0,0,0),animspd) | |
1103 | llw.C0 = clerp(llw.C0, cf(0,0,0)*Left_Leg_*ang(0,0,0),animspd) | |
1104 | end | |
1105 | ||
1106 | end) | |
1107 | ||
1108 | --[[ Default Welds | |
1109 | local animspd = .3 | |
1110 | ||
1111 | local Right_Arm_ = cf(0,0,0) | |
1112 | local Left_Arm_ = cf(0,0,0) | |
1113 | local Right_Leg_ = cf(0,0,0) | |
1114 | local Left_Leg_ = cf(0,0,0) | |
1115 | local Head_ = cf(0,0,0) | |
1116 | local Torso_ = cf(0,0,0) | |
1117 | ||
1118 | torw.C0 = clerp(torw.C0, cf(0,0,0)*Torso_*ang(0,0,0),animspd) | |
1119 | hedw.C0 = clerp(hedw.C0, cf(0,0,0)*Head_*ang(0,0,0),animspd) | |
1120 | law.C0 = clerp(law.C0, cf(0,0,0)*Left_Arm_*ang(0,0,0),animspd) | |
1121 | raw.C0 = clerp(raw.C0, cf(0,0,0)*Right_Arm_*ang(0,0,0),animspd) | |
1122 | rlw.C0 = clerp(rlw.C0, cf(0,0,0)*Right_Leg_*ang(0,0,0),animspd) | |
1123 | llw.C0 = clerp(llw.C0, cf(0,0,0)*Left_Leg_*ang(0,0,0),animspd) | |
1124 | --]] |