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 | local h,t | |
| 87 | --Give the server mouse data every second frame, but only if the values changed | |
| 88 | --If player is not moving their mouse, client won't fire events | |
| 89 | local HB = game:GetService("RunService").Heartbeat
| |
| 90 | while true do | |
| 91 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 92 | h,t=Mouse.Hit,Mouse.Target | |
| 93 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 94 | end | |
| 95 | --Wait 2 frames | |
| 96 | for i=1,2 do | |
| 97 | HB:Wait() | |
| 98 | end | |
| 99 | end]==],script) | |
| 100 | ||
| 101 | ----Sandboxed game object that allows the usage of client-side methods and services | |
| 102 | --Real game object | |
| 103 | local RealGame = game | |
| 104 | ||
| 105 | --Metatable for fake service | |
| 106 | local FakeService_Metatable = {
| |
| 107 | __index = function(self,k) | |
| 108 | local s = rawget(self,"_RealService") | |
| 109 | if s then | |
| 110 | return typeof(s[k])=="function" | |
| 111 | and function(_,...)return s[k](s,...)end or s[k] | |
| 112 | end | |
| 113 | end, | |
| 114 | __newindex = function(self,k,v) | |
| 115 | local s = rawget(self,"_RealService") | |
| 116 | if s then s[k]=v end | |
| 117 | end | |
| 118 | } | |
| 119 | local function FakeService(t,RealService) | |
| 120 | t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService | |
| 121 | return setmetatable(t,FakeService_Metatable) | |
| 122 | end | |
| 123 | ||
| 124 | --Fake game object | |
| 125 | local FakeGame = {
| |
| 126 | GetService = function(self,s) | |
| 127 | return rawget(self,s) or RealGame:GetService(s) | |
| 128 | end, | |
| 129 | Players = FakeService({
| |
| 130 | LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
| |
| 131 | },"Players"), | |
| 132 | UserInputService = FakeService(UIS,"UserInputService"), | |
| 133 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
| 134 | RunService = FakeService({
| |
| 135 | _btrs = {},
| |
| 136 | RenderStepped = RealGame:GetService("RunService").Heartbeat,
| |
| 137 | BindToRenderStep = function(self,name,_,fun) | |
| 138 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
| 139 | end, | |
| 140 | UnbindFromRenderStep = function(self,name) | |
| 141 | self._btrs[name]:Disconnect() | |
| 142 | end, | |
| 143 | },"RunService") | |
| 144 | } | |
| 145 | rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer) | |
| 146 | FakeGame.service = FakeGame.GetService | |
| 147 | FakeService(FakeGame,game) | |
| 148 | --Changing owner to fake player object to support owner:GetMouse() | |
| 149 | game,owner = FakeGame,FakeGame.Players.LocalPlayer | |
| 150 | end | |
| 151 | ||
| 152 | local oldtick = tick() | |
| 153 | warn("Omae Wa Mou Shinderu")
| |
| 154 | local plr = game:GetService("Players").LocalPlayer
| |
| 155 | local char, mouse = plr.Character, plr:GetMouse() | |
| 156 | local hitTab = {}
| |
| 157 | local fadeTab = {}
| |
| 158 | local spd = 0.2 * char:FindFirstChild("Humanoid").WalkSpeed / 16
| |
| 159 | local sound1 = Instance.new("Sound", char.HumanoidRootPart)
| |
| 160 | local sound2 = Instance.new("Sound", char.HumanoidRootPart)
| |
| 161 | local sound3 = Instance.new("Sound")
| |
| 162 | sound1.SoundId = "rbxassetid://130767866" | |
| 163 | sound1.Volume = 10 | |
| 164 | sound2.SoundId = "rbxassetid://142684400" | |
| 165 | sound2.Volume = 10 | |
| 166 | sound3.SoundId = "rbxassetid://985132972" | |
| 167 | sound3.Volume = 10 | |
| 168 | local particle = Instance.new("ParticleEmitter")
| |
| 169 | particle.LightEmission = 0.2 | |
| 170 | particle.Texture = "rbxassetid://50263573" | |
| 171 | particle.Size = NumberSequence.new({
| |
| 172 | NumberSequenceKeypoint.new(0, 0), | |
| 173 | NumberSequenceKeypoint.new(0.5, 1), | |
| 174 | NumberSequenceKeypoint.new(1, 0) | |
| 175 | }) | |
| 176 | particle.Acceleration = Vector3.new(0, 0, 0) | |
| 177 | particle.Lifetime = NumberRange.new(0.15, 0.3) | |
| 178 | particle.Rate = 50 | |
| 179 | particle.Rotation = NumberRange.new(0, 360) | |
| 180 | particle.RotSpeed = NumberRange.new(0, 0) | |
| 181 | particle.Speed = NumberRange.new(0, 0) | |
| 182 | local dfj = {}
| |
| 183 | char:WaitForChild("Animate"):Destroy()
| |
| 184 | char:WaitForChild("Humanoid"):WaitForChild("Animator"):Destroy()
| |
| 185 | for i, v in pairs(char:FindFirstChild("Torso"):GetChildren()) do
| |
| 186 | if v:IsA("Motor6D") and v.Name ~= "Neck" then
| |
| 187 | table.insert(dfj, v:Clone()) | |
| 188 | v:Destroy() | |
| 189 | end | |
| 190 | end | |
| 191 | local state = "idle" | |
| 192 | local rootpart = char:FindFirstChild("HumanoidRootPart")
| |
| 193 | local rootjoint = rootpart:FindFirstChild("RootJoint")
| |
| 194 | rootjoint.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(180)) | |
| 195 | local rarm = Instance.new("Weld", char:FindFirstChild("Right Arm") or nil)
| |
| 196 | rarm.Part0 = char:FindFirstChild("Torso") or nil
| |
| 197 | rarm.Part1 = char:FindFirstChild("Right Arm") or nil
| |
| 198 | rarm.C0 = CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
| 199 | rarm.C1 = CFrame.new(-0.5, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
| 200 | local larm = Instance.new("Weld", char:FindFirstChild("Left Arm") or nil)
| |
| 201 | larm.Part0 = char:FindFirstChild("Torso") or nil
| |
| 202 | larm.Part1 = char:FindFirstChild("Left Arm") or nil
| |
| 203 | larm.C0 = CFrame.new(-1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
| 204 | larm.C1 = CFrame.new(0.5, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
| 205 | local rleg = Instance.new("Weld", char:FindFirstChild("Right Leg") or nil)
| |
| 206 | rleg.Part0 = char:FindFirstChild("Torso") or nil
| |
| 207 | rleg.Part1 = char:FindFirstChild("Right Leg") or nil
| |
| 208 | rleg.C0 = CFrame.new(1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
| 209 | rleg.C1 = CFrame.new(0.5, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
| 210 | local lleg = Instance.new("Weld", char:FindFirstChild("Left Leg") or nil)
| |
| 211 | lleg.Part0 = char:FindFirstChild("Torso") or nil
| |
| 212 | lleg.Part1 = char:FindFirstChild("Left Leg") or nil
| |
| 213 | lleg.C0 = CFrame.new(-1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
| 214 | lleg.C1 = CFrame.new(-0.5, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
| 215 | local neck = char:FindFirstChild("Torso"):FindFirstChild("Neck") or nil
| |
| 216 | neck.Part0 = char:FindFirstChild("Torso") or nil
| |
| 217 | neck.Part1 = char:FindFirstChild("Head") or nil
| |
| 218 | neck.C0 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
| 219 | neck.C1 = CFrame.new(0, -0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
| 220 | function hitSphere() | |
| 221 | local function recSearch(par) | |
| 222 | local tab = {}
| |
| 223 | local function rec(parent) | |
| 224 | if parent:IsA("Humanoid") and parent ~= char:FindFirstChildOfClass("Humanoid") then
| |
| 225 | table.insert(tab, parent) | |
| 226 | end | |
| 227 | for i, v in pairs(parent:GetChildren()) do | |
| 228 | rec(v) | |
| 229 | end | |
| 230 | end | |
| 231 | rec(par) | |
| 232 | return tab | |
| 233 | end | |
| 234 | local humsFound = {}
| |
| 235 | for i, v in pairs(recSearch(workspace)) do | |
| 236 | table.insert(humsFound, v) | |
| 237 | end | |
| 238 | return humsFound | |
| 239 | end | |
| 240 | mouse.Button1Down:connect(function() | |
| 241 | if state ~= "busy" then | |
| 242 | state = "busy" | |
| 243 | do | |
| 244 | local foundHums = {}
| |
| 245 | local prtcls = {}
| |
| 246 | local sounds = {}
| |
| 247 | local parts = {}
| |
| 248 | sound1:Play() | |
| 249 | local hit = false | |
| 250 | local toggle = false | |
| 251 | local frmcon | |
| 252 | local frame = 0 | |
| 253 | frmcon = game:service("RunService").RenderStepped:connect(function()
| |
| 254 | frame = frame + 1 | |
| 255 | if frame / 4 == math.floor(frame / 4) then | |
| 256 | if toggle == false then | |
| 257 | toggle = true | |
| 258 | else | |
| 259 | toggle = false | |
| 260 | end | |
| 261 | end | |
| 262 | if toggle == true then | |
| 263 | 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) | |
| 264 | 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) | |
| 265 | 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) | |
| 266 | 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) | |
| 267 | 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) | |
| 268 | neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(-45), math.rad(0)), spd * 1.5) | |
| 269 | else | |
| 270 | 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) | |
| 271 | 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) | |
| 272 | 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) | |
| 273 | 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) | |
| 274 | 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) | |
| 275 | neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(45), math.rad(0)), spd * 1.5) | |
| 276 | end | |
| 277 | if frame % 5 == 0 then | |
| 278 | for i, v in pairs(hitSphere()) do | |
| 279 | for o, b in pairs(v.Parent:GetChildren()) do | |
| 280 | if b:IsA("BasePart") and 4 >= (b.Position - rootjoint.Parent.CFrame * CFrame.new(0, 0, -2.25).p).Magnitude then
| |
| 281 | hit = true | |
| 282 | if foundHums[v] then | |
| 283 | foundHums[v] = foundHums[v] + 1 | |
| 284 | else | |
| 285 | foundHums[v] = 1 | |
| 286 | local ns = sound3:Clone() | |
| 287 | ns.Parent = b | |
| 288 | table.insert(sounds, ns) | |
| 289 | end | |
| 290 | if not prtcls[b] then | |
| 291 | partClone = particle:Clone() | |
| 292 | partClone.Enabled = false | |
| 293 | partClone.Parent = b | |
| 294 | prtcls[b] = partClone | |
| 295 | end | |
| 296 | local p = Instance.new("Part")
| |
| 297 | p.Size = Vector3.new(0.2, 0.2, 0.2) | |
| 298 | p.Color = Color3.new(1, 1, 1) | |
| 299 | p.TopSurface = "Smooth" | |
| 300 | p.BottomSurface = "Smooth" | |
| 301 | p.Anchored = true | |
| 302 | p.CanCollide = false | |
| 303 | p.Shape = "Ball" | |
| 304 | p.CFrame = CFrame.new(b.CFrame.p + Vector3.new(math.random(-10, 10) / 10, math.random(-10, 10) / 10, math.random(-10, 10) / 10)) | |
| 305 | p.Parent = workspace | |
| 306 | table.insert(fadeTab, p) | |
| 307 | parts[b] = b | |
| 308 | end | |
| 309 | end | |
| 310 | end | |
| 311 | end | |
| 312 | end) | |
| 313 | local bucon | |
| 314 | bucon = mouse.Button1Up:connect(function() | |
| 315 | frmcon:disconnect() | |
| 316 | sound1:Stop() | |
| 317 | state = "idle" | |
| 318 | if hit == true then | |
| 319 | sound2:Play() | |
| 320 | wait(2.7) | |
| 321 | for i, v in pairs(sounds) do | |
| 322 | spawn(function() | |
| 323 | wait(math.random(0, 100) / 600) | |
| 324 | v.TimePosition = 2.5 | |
| 325 | v:Play() | |
| 326 | end) | |
| 327 | end | |
| 328 | wait(1.2) | |
| 329 | for i, v in pairs(prtcls) do | |
| 330 | v.Enabled = true | |
| 331 | end | |
| 332 | wait(1.3) | |
| 333 | spawn(function() | |
| 334 | local rcon | |
| 335 | local frame = 0 | |
| 336 | rcon = game:service("RunService").RenderStepped:connect(function()
| |
| 337 | frame = frame + 1 | |
| 338 | for i, v in pairs(sounds) do | |
| 339 | v.Volume = 10 - frame / 5 | |
| 340 | if v.Volume <= 0 then | |
| 341 | v.Volume = 0 | |
| 342 | v:Destroy() | |
| 343 | end | |
| 344 | end | |
| 345 | if frame >= 200 then | |
| 346 | for i, v in pairs(sounds) do | |
| 347 | v:Destroy() | |
| 348 | end | |
| 349 | end | |
| 350 | end) | |
| 351 | end) | |
| 352 | for i, v in pairs(parts) do | |
| 353 | v.RotVelocity = Vector3.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100)) | |
| 354 | v.Velocity = v.Velocity + Vector3.new(0, 20, 0) | |
| 355 | local bvel = Instance.new("BodyVelocity", v)
| |
| 356 | bvel.MaxForce = Vector3.new(1000000, 1000000, 1000000) | |
| 357 | bvel.Velocity = Vector3.new(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)) | |
| 358 | game:service("Debris"):AddItem(bvel, 0.5)
| |
| 359 | end | |
| 360 | for i, v in pairs(foundHums) do | |
| 361 | if i.MaxHealth >= math.huge then | |
| 362 | i.MaxHealth = 100 | |
| 363 | end | |
| 364 | i.Health = 0 | |
| 365 | end | |
| 366 | wait(0.7) | |
| 367 | for i, v in pairs(prtcls) do | |
| 368 | v.Enabled = false | |
| 369 | end | |
| 370 | end | |
| 371 | bucon:disconnect() | |
| 372 | end) | |
| 373 | end | |
| 374 | end | |
| 375 | end) | |
| 376 | game:GetService("RunService").Heartbeat:connect(function()
| |
| 377 | for i, v in pairs(fadeTab) do | |
| 378 | v.Transparency = v.Transparency + 0.1 | |
| 379 | local savecf = v.CFrame | |
| 380 | v.Size = v.Size + Vector3.new(0.3, 0.3, 0.3) | |
| 381 | v.CFrame = savecf | |
| 382 | end | |
| 383 | local isub = 0 | |
| 384 | for i = 1, #fadeTab do | |
| 385 | if fadeTab[i - isub].Transparency >= 1 then | |
| 386 | fadeTab[i - isub]:Destroy() | |
| 387 | table.remove(fadeTab, i - isub) | |
| 388 | isub = isub + 1 | |
| 389 | end | |
| 390 | end | |
| 391 | char:FindFirstChild("Humanoid").WalkSpeed = 26
| |
| 392 | spd = 0.2 * char:FindFirstChild("Humanoid").WalkSpeed / 16
| |
| 393 | if state ~= "busy" then | |
| 394 | local ray = Ray.new(rootpart.Position, Vector3.new(0, -4, 0)) | |
| 395 | local part, pos, normal = workspace:FindPartOnRayWithIgnoreList(ray, char:GetChildren(), false, true) | |
| 396 | if rootpart.Velocity.Magnitude > 0.5 and part ~= nil then | |
| 397 | state = "running" | |
| 398 | elseif rootpart.Velocity.Magnitude <= 0.5 and part ~= nil then | |
| 399 | state = "idle" | |
| 400 | elseif 0 < rootpart.Velocity.Y and part == nil then | |
| 401 | state = "jumping" | |
| 402 | elseif 0 >= rootpart.Velocity.Y and part == nil then | |
| 403 | state = "falling" | |
| 404 | end | |
| 405 | if state == "idle" then | |
| 406 | 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) | |
| 407 | 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) | |
| 408 | 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) | |
| 409 | 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) | |
| 410 | 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) | |
| 411 | neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
| 412 | elseif state == "running" then | |
| 413 | 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) | |
| 414 | 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) | |
| 415 | 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) | |
| 416 | 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) | |
| 417 | rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-110), math.rad(0), math.rad(180)), spd) | |
| 418 | neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)), spd) | |
| 419 | elseif state == "jumping" then | |
| 420 | rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
| 421 | lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
| 422 | rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
| 423 | larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
| 424 | rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(180)), spd) | |
| 425 | neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
| 426 | elseif state == "falling" then | |
| 427 | rleg.C0 = rleg.C0:lerp(CFrame.new(1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
| 428 | lleg.C0 = lleg.C0:lerp(CFrame.new(-1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
| 429 | rarm.C0 = rarm.C0:lerp(CFrame.new(1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
| 430 | larm.C0 = larm.C0:lerp(CFrame.new(-1, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
| 431 | rootjoint.C0 = rootjoint.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(180)), spd) | |
| 432 | neck.C0 = neck.C0:lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), spd) | |
| 433 | end | |
| 434 | end | |
| 435 | end) | |
| 436 | warn("Loaded! Time elapsed: " .. tick() - oldtick) |