Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Player can't move when standing still while an animation is playing?

Asked by 4 years ago

I was trying to play a crouch animation, to let the player crouch obviously, but for some reason, if I crouch while I'm standing still, or stand still while I'm walking, I am unable to move. It's a LocalScript with a RemoteEvent going to a ServerScript. Here is the LocalScript:

player = game.Players.LocalPlayer
UserInputService = game:GetService("UserInputService")
cam = game.Workspace.CurrentCamera

UserInputService.InputBegan:Connect(function(key,wtfwtf)
    if key.KeyCode == Enum.KeyCode.LeftControl then
        print("hi")
        game.ReplicatedStorage.Animator:FireServer(game.ReplicatedStorage.Animations.Crouch,true,true)
        game.ReplicatedStorage.Speed:FireServer(4)
    end
end)

UserInputService.InputEnded:Connect(function(key,wtfwtf)
    if key.KeyCode == Enum.KeyCode.LeftControl then
        game.ReplicatedStorage.AnimatorStop:FireServer()
        game.ReplicatedStorage.Speed:FireServer(16)
    end
end)

And here is the ServerScript:

game.ReplicatedStorage.Animator.OnServerEvent:Connect(function(player, anim, isMovement)
    print("porg")
    local animator = player.Character:FindFirstChild("Humanoid"):FindFirstChildOfClass("Animator")
    local anon = animator:LoadAnimation(anim)
    print("1")
    if isMovement == true then
        anon.Priority = 'Movement'
        anon:Play()
    else
        anon:Play()
    end
    game.ReplicatedStorage.AnimatorStop.OnServerEvent:Wait()
    anon:Stop()
end)

Could someone figure out why this is happening?

1 answer

Log in to vote
0
Answered by 4 years ago

ok uh so apparently I can move now idk what happened but the animation stops playing when I stand still then start walking while holding control

Ad

Answer this question