I want to change animation instantly using scripting without needing to walk.
You can see the issue in a video here. Look at output too
This is the script that I have tried.:
local ReplicatedStorage = game:GetService("ReplicatedStorage");
local Character = game:GetService("Players").LocalPlayer.Character;
local Debounce = false;
game:GetService("UserInputService").InputBegan:Connect(function(Input, Process)
if Input.KeyCode == Enum.KeyCode.E then
if Debounce == false then
Debounce = true;
Character:WaitForChild("Animate"):WaitForChild("idle"):WaitForChild("IdleAnim").AnimationId = "rbxassetid://11484555705";
print("Changed Animation");
else
Debounce = false;
Character:WaitForChild("Animate"):WaitForChild("idle"):WaitForChild("IdleAnim").AnimationId = "http://www.roblox.com/asset/?id=507766388";
print("Reverted");
end
end
end)
If this is not clear, you can ask me more at comment.
i think that you can make the player plays the idle animation, something like this:
local animation = Instance.new('Animation', ...)
local animator = playerHumanoid.Animator
animation.AnimationId = 'rbxassetid://' -- your idle id
animation = animator:LoadAnimation(animation)
animation:Play()
OBS: Don’t put the animation looped! May cause some bugs on walking.