-
What do you want to achieve? A working animation.
-
What is the issue? Sometimes the animation works sometimes it doesnt and all i get is the roblox default idle animation.
-
What solutions have you tried so far? Adding print() to see if it runs, it does it just doesnt remove the default animation.
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Torso = Character:WaitForChild("Torso")
local RightShoulder = Torso:WaitForChild("Right Shoulder")
local LeftShoulder = Torso:WaitForChild("Left Shoulder")
local RightHip = Torso:WaitForChild("Right Hip")
local LeftHip = Torso:WaitForChild("Left Hip")
local Neck = Torso:WaitForChild("Neck")
local Pose = "Standing"
Character:WaitForChild("Animate"):Destroy()
Humanoid.Running:Connect(function(Speed)
if Speed > 0 and Humanoid.MoveDirection.Magnitude > 0 then
Pose = "Running"
else
Pose = "Standing"
end
end)
Humanoid.Died:Connect(function()
Pose = "Dead"
end)
Humanoid.Jumping:Connect(function()
Pose = "Jumping"
end)
Humanoid.Climbing:Connect(function()
Pose = "Climbing"
end)
Humanoid.GettingUp:Connect(function()
Pose = "GettingUp"
end)
Humanoid.FreeFalling:Connect(function()
Pose = "FreeFall"
end)
Humanoid.FallingDown:Connect(function()
Pose = "FallingDown"
end)
Humanoid.Seated:Connect(function()
Pose = "Seated"
end)
Humanoid.PlatformStanding:Connect(function()
Pose = "PlatformStanding"
end)
local function JumpOrFreeFall()
RightShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.MaxVelocity = 0.5
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
local function Move(Time)
local Amplitude = 0
local Frequency = 0
local ClimbFudge = 0
if Pose == "Jumping" then
JumpOrFreeFall()
return
end
if Pose == "FreeFall" then
JumpOrFreeFall()
return
end
if Pose == "Seated" then
RightShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = 3.14/2
LeftShoulder.MaxVelocity = 0.15
LeftShoulder.DesiredAngle = -3.14/2
RightHip.DesiredAngle = 3.14/2
LeftHip.DesiredAngle = -3.14/2
return
end
if Pose == "Running" then
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
Amplitude = 1
Frequency = 9
elseif Pose == "Climbing" then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
Amplitude = 1
Frequency = 9
ClimbFudge = 3.14
else
Amplitude = 0
Frequency = 0
end
local DesiredAngle = Amplitude * math.sin(Time * Frequency)
if Character:FindFirstChildWhichIsA("Tool") and Pose ~= "Climbing" then
RightShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = 3.14/2
LeftShoulder.DesiredAngle = DesiredAngle - ClimbFudge
RightHip.DesiredAngle = -DesiredAngle
LeftHip.DesiredAngle = -DesiredAngle
else
RightShoulder.DesiredAngle = DesiredAngle + ClimbFudge
LeftShoulder.DesiredAngle = DesiredAngle - ClimbFudge
RightHip.DesiredAngle = -DesiredAngle
LeftHip.DesiredAngle = -DesiredAngle
end
end
while Character ~= nil do
local _, Time = wait(0.1)
Move(Time)
end