I’m making it so that the walk/idle animations of the player are updated depending on their health.
I change the animation id’s in the animate script and set the definition of the animation ids in the script like so
idle = {
{ id = script:WaitForChild("idle").Animation1.AnimationId, weight = 9 },
{ id = script:WaitForChild("idle").Animation2.AnimationId, weight = 1 }
},
walk = {
{ id = script:WaitForChild("walk").WalkAnim.AnimationId, weight = 10 }
},
run = {
{ id = "run.xml", weight = 10 }
},
I then change their IDs with this script
local char = script.Parent
char.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
local health = char.Humanoid.Health
if not char:FindFirstChild("brokenLeg") then --if you arent crippled (if you are, we want you to stay the same speed that you are)
if health <= 20 then
char.Humanoid.WalkSpeed = 7
char.Humanoid.JumpHeight = 0
script.Parent.Animate.walk.WalkAnim.AnimationId = "rbxassetid://10721931379"
script.Parent.Animate.idle.Animation1.AnimationId = "rbxassetid://10721734194"
script.Parent.Animate.idle.Animation2.AnimationId = "rbxassetid://10721734194"
end
if health >= 21 and health <= 50 then
char.Humanoid.WalkSpeed = 12
char.Humanoid.JumpHeight = 4
script.Parent.Animate.walk.WalkAnim.AnimationId = "rbxassetid://10718081768"
script.Parent.Animate.idle.Animation1.AnimationId = "rbxassetid://10718192940"
script.Parent.Animate.idle.Animation2.AnimationId = "rbxassetid://10718192940"
end
if health > 50 then
char.Humanoid.WalkSpeed = 16
char.Humanoid.JumpHeight = 7.2
script.Parent.Animate.walk.WalkAnim.AnimationId = "rbxassetid://10712693225"
script.Parent.Animate.idle.Animation1.AnimationId = "rbxassetid://180435571"
script.Parent.Animate.idle.Animation2.AnimationId = "rbxassetid://180435571"
end
end
end)
This works perfectly on the client, but when I look at it on the server, or from another player’s perspective, the animations are all janky, and it seems to look like a mix between the default roblox animations and my own. I don’t know how on earth this is happening or where to even begin to try and fix it, so hopefully some of yall can