-
What do you want to achieve? I want to swap out the player’s walk and idle animations for crouch versions of the walk and idle animations, and have that happen instantly.
-
What is the issue? After the two animations have had their animation ids changed, they do not actually update until the player has moved and stopped again. I assume this is because the idle and walk animations have been stopped and started again, but I am unsure how to make this process happen via a script.
-
What solutions have you tried so far? I’ve looked around on the developer hub, but, asked some of my scripting friends, searched on youtube, and i’ve read through a bit of the animate documentation.
This is the code I have to actually do the crouching.
-- LocalScript as animations are replicated to the server.
local Animate = Character:WaitForChild("Animate")
local Idle = Animate:WaitForChild("idle"):FindFirstChildOfClass("Animation")
local Walk = Animate:WaitForChild("walk"):FindFirstChildOfClass("Animation")
local DefaultIdle = Idle.AnimationId
local DefaultWalk = Walk.AnimationId
local CrouchIdle = script.CrouchIdle.AnimationId
local CrouchWalk = script.CrouchWalk.AnimationId
local function Crouch()
if Idle.AnimationId == DefaultIdle then
Idle.AnimationId = CrouchIdle
Walk.AnimationId = CrouchWalk
else
Idle.AnimationId = DefaultIdle
Walk.AnimationId = DefaultWalk
end
end
Thanks in advance.