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 = math.sin, math.sinh, math.asin, math.cos, math.max, math.min, math.clamp, math.rad, math.pi
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 exactVel = 0
local vel = 0
local animMove = false
local action = "BlueShirt"
local animTable = {
BlueShirt = function()
return {
nk = nkc0 *
CFrame.Angles(-cos(t / 6) / 5, cos(t / 12) / 5, -cos(t / 6) / 10),
rj = rjc0 *
CFrame.new(smoothStep(-cos(t / 24), 4, 0.5), sin(t / 6) / 5, 0) *
CFrame.Angles(math.rad(3) + cos(t / 6) / 5, -cos(t / 12) / 5, cos(t / 6) / 7.5),
ls = lsc0 *
CFrame.Angles(0, 0, -rad(75) + sin(t / 6) / 2.5 + max(-sin(t / 48) ^ 3, 0)) *
CFrame.Angles(rad(45), 0, 0),
rs = rsc0 *
CFrame.Angles(0, 0, rad(75) + sin(t / 6) / 2.5 - max(-sin(t / 48) ^ 3, 0)) *
CFrame.Angles(rad(45), 0, 0),
lh = {Stabilized = true, Pose = lhc0 *
CFrame.new(smoothStep(-cos(t / 24), 4, 0.5), 0, 0) *
CFrame.new(0 + max(-cos(t / 24) ^ 33, 0) / 1.5, -max(-cos(t / 24 - pi / 16 - pi / 8) ^ 33 / 5, 0), -0.125 + max(-cos(t / 24) ^ 33, 0) / 1.5 - cos(t / 6) / 5) *
CFrame.Angles(-max(-cos(t / 24 - pi / 8) ^ 5, 0) - cos(t / 6) / 10, max(-cos(t / 24 - pi / 16) ^ 5, 0), -rad(14) + max(-cos(t / 24 - pi / 16) ^ 5 * 1.25, 0) - smoothStep(-cos(t / 24), 4, 0.25))
},
rh = {Stabilized = true, Pose = rhc0 *
CFrame.new(smoothStep(-cos(t / 24), 4, 0.5), 0, 0) *
CFrame.new(0 - max(cos(t / 24) ^ 33, 0) / 1.5, -max(cos(t / 24 - pi / 16 - pi / 8) ^ 33 / 5, 0), -0.125 + max(cos(t / 24) ^ 33, 0) / 1.5 - cos(t / 6) / 5) *
CFrame.Angles(-rad(12) - max(cos(t / 24 - pi / 8) ^ 5, 0) - cos(t / 6) / 10, -max(cos(t / 24 - pi / 16) ^ 5, 0), rad(14) - max(cos(t / 24 - pi / 16) ^ 5 * 1.25, 0) - smoothStep(-cos(t / 24), 4, 0.25))
},
}
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
exactVel = CFrame.new(root.CFrame:VectorToObjectSpace(root.Velocity))
vel = Vector3.new(math.clamp(exactVel.x, -64, 64), math.clamp(exactVel.y, -64, 64), math.clamp(exactVel.z, -64, 64))
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)