Untitled

Run Settings
LanguageLua
Language Version
Run Command
local chr = owner.Character local root = chr.HumanoidRootPart local hum = chr.Humanoid hum.WalkSpeed = 24 local function joint(p0, p1, c0, c1, name) local w = Instance.new("Weld") w.Part0 = p0 w.Part1 = p1 w.C0 = c0 w.C1 = c1 w.Name = name w.Parent = p0 return w end local function Lerp(a, b, t, dt) local alpha = 1 - (1 - t) ^ dt return a:Lerp(b, alpha) end local raycastParams = RaycastParams.new() raycastParams.FilterDescendantsInstances = {owner.Character} raycastParams.FilterType = Enum.RaycastFilterType.Exclude raycastParams.RespectCanCollide = true raycastParams.IgnoreWater = true raycastParams.BruteForceAllSlow = true local sin, sinh, asin, cos, max, min, clamp, rad, pi, abs = math.sin, math.sinh, math.asin, math.cos, math.max, math.min, math.clamp, math.rad, math.pi, math.abs local function smoothStep(x, steepness, amplitude) return amplitude * (1 / (1 + math.exp(-steepness * x)) - 0.5) end local nk = joint(chr.Torso, chr.Head, CFrame.new(0, 1, 0), CFrame.new(0, -0.5, 0), "Neck") local rj = joint(root, chr.Torso, CFrame.new(), CFrame.new(), "RootJoint") local rs = joint(chr.Torso, chr:FindFirstChild("Right Arm"), CFrame.new(1.5, 0.5, 0), CFrame.new(0, 0.5, 0), "Right Shoulder") local ls = joint(chr.Torso, chr:FindFirstChild("Left Arm"), CFrame.new(-1.5, 0.5, 0), CFrame.new(0, 0.5, 0), "Left Shoulder") local rh = joint(chr.Torso, chr:FindFirstChild("Right Leg"), CFrame.new(0.5, -1, 0), CFrame.new(0, 1, 0), "Right Hip") local lh = joint(chr.Torso, chr:FindFirstChild("Left Leg"), CFrame.new(-0.5, -1, 0), CFrame.new(0, 1, 0), "Left Hip") local rsc0, lsc0, rhc0, lhc0, rjc0, nkc0 = rs.C0, ls.C0, rh.C0, lh.C0, rj.C0, nk.C0 local t = os.clock() local vel = 0 local animMove = true local action = "" local animTable = { Idle = function() return { nk = nkc0 * CFrame.Angles(rad(35) + cos(t / 10) / 40, -rad(15), rad(7)), rj = rjc0 * CFrame.new(0, -0.25 + sin(t / 10) / 20, 0) * CFrame.Angles(-rad(35) - cos(t / 10) / 20, rad(15), cos(t / 10 - pi / 4) / 40), ls = lsc0 * CFrame.new(0, -0.125 - cos(t / 10) / 40, 0.125 - cos(t / 10) / 40) * CFrame.Angles(-rad(15) + cos(t / 10 - pi / 4) / 10, rad(15), -rad(20) + sin(t / 10) / 20), rs = rsc0 * CFrame.new(0, -0.125, -0.125) * CFrame.Angles(rad(25) - cos(t / 10 + pi / 4) / 40, -rad(7), rad(15) - cos(t / 10) / 20), lh = {Stabilized = true, Pose = lhc0 * CFrame.new(-0.0625, -0.375 - cos(t / 10) / 20, -cos(t / 10) / 10) * CFrame.Angles(-rad(35) - cos(t / 10) / 20, rad(15), -rad(15)) }, rh = {Stabilized = true, Pose = rhc0 * CFrame.new(0.0625, 0, -0.5 + cos(t / 10) / 10) * CFrame.Angles(rad(7) + cos(t / 10) / 20, -rad(7) + cos(t / 10 - pi / 4) / 40, rad(3)) }, } end, Walk = function() return { nk = nkc0 * CFrame.Angles(-vel.Z / 48, -sin(t / 5) / 5 * (-vel.Z / 24), 0), rj = rjc0 * CFrame.new(0, sin(t / 2.5) / 5, 0) * CFrame.Angles(vel.Z / 48 - cos(t / 2.5) / 10 * (-vel.Z / 24), sin(t / 5) / 5 * (-vel.Z / 24) - (vel.X / 96), -cos(t / 2.5) / 20 * (vel.X / 24)), ls = lsc0 * CFrame.new(0.125 + math.min(-sin(t / 5) / 5 * (-vel.Z / 24), 0) - abs(vel.X / 192), -0.25 + abs(vel.X / 96), cos(t / 5) / 3 * (-vel.Z / 24)) * CFrame.Angles(-vel.Z / 96 - sin(t / 5) * 1.5 * (-vel.Z / 24), sin(t / 5 - pi / 6) / 2 * (-vel.Z / 24), -rad(3) - sin(t / 5) / 2 * (-vel.Z / 24) - max(vel.X / 96, 0)), rs = rsc0 * CFrame.new(-0.125 + math.max(-sin(t / 5) / 5 * (-vel.Z / 24), 0) + abs(vel.X / 192), -0.25 + abs(vel.X / 96), -cos(t / 5) / 3 * (-vel.Z / 24)) * CFrame.Angles(-vel.Z / 96 + sin(t / 5) * 1.5 * (-vel.Z / 24), sin(t / 5 - pi / 6) / 2 * (-vel.Z / 24), rad(3) - sin(t / 5) / 2 * (-vel.Z / 24) - min(vel.X / 96, 0)), lh = lhc0 * CFrame.new(0, cos(t / 5) / 1.5, -0.375 - cos(t / 5) / 1.5 * (-vel.Z / 24) + vel.X / 96) * CFrame.Angles(-vel.X / 96 + sin(t / 5) * (-vel.Z / 24), rad(3), -rad(3) + sin(t / 5) * (vel.X / 24)), rh = rhc0 * CFrame.new(0, -cos(t / 5) / 1.5, -0.375 + cos(t / 5) / 1.5 * (-vel.Z / 24) - vel.X / 96) * CFrame.Angles(vel.X / 96 - sin(t / 5) * (-vel.Z / 24), -rad(3), rad(3) - sin(t / 5) * (vel.X / 24)) } end, Jump = function() return { nk = nkc0, rj = rjc0 * CFrame.new() * CFrame.Angles(clamp(-vel.Y / 192, -1, 1), 0, 0), ls = lsc0, rs = rsc0, lh = lhc0, rh = rhc0 * CFrame.new(0, -vel.Y / 96, 0) } end } local keyFuncs = { F = function() animMove = not animMove action = "Hugo" end, } local joints = {rj = {rj, rjc0, CFrame.new()}, nk = {nk, nkc0, CFrame.new()}, ls = {ls, lsc0, CFrame.new()}, rs = {rs, rsc0, CFrame.new()}, lh = {lh, lhc0, CFrame.new()}, rh = {rh, rhc0, CFrame.new()}} game:GetService("RunService").PostSimulation:Connect(function(dt) t = os.clock() * 60 vel = root.CFrame:VectorToObjectSpace(root.Velocity) if animMove then if hum:GetState() ~= Enum.HumanoidStateType.Climbing then if not hum.Sit then if hum.FloorMaterial == Enum.Material.Air then action = "Jump" else action = hum.MoveDirection.Magnitude > 0 and "Walk" or "Idle" end else action = "Sit" end else if math.abs(vel.Y) > 0 then action = "Climb" end end end for i, v in next, joints do local joint, jointc0, transform = v[1], v[2], v[3] if animTable[action] and animTable[action]()[i] then local animCF = animTable[action]()[i] local stabilized if typeof(animCF) == "table" and animCF["Stabilized"] then stabilized = true animCF = animCF["Pose"] end v[3] = Lerp(v[3], jointc0:Inverse() * animCF, 0.3, dt * 60) transform = v[3] joint.C0 = (stabilized and joint.Part0.CFrame:Inverse() * root.CFrame * jointc0 or jointc0) * transform end end end) local uis = game:GetService("UserInputService") uis.InputEnded:Connect(function(key, gp) key = key.KeyCode if not gp and keyFuncs[tostring(key):sub(14)] then keyFuncs[tostring(key):sub(14)]() end end)
Editor Settings
Theme
Key bindings
Full width
Lines