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:

01player = game.Players.LocalPlayer
02UserInputService = game:GetService("UserInputService")
03cam = game.Workspace.CurrentCamera
04 
05UserInputService.InputBegan:Connect(function(key,wtfwtf)
06    if key.KeyCode == Enum.KeyCode.LeftControl then
07        print("hi")
08        game.ReplicatedStorage.Animator:FireServer(game.ReplicatedStorage.Animations.Crouch,true,true)
09        game.ReplicatedStorage.Speed:FireServer(4)
10    end
11end)
12 
13UserInputService.InputEnded:Connect(function(key,wtfwtf)
14    if key.KeyCode == Enum.KeyCode.LeftControl then
15        game.ReplicatedStorage.AnimatorStop:FireServer()
16        game.ReplicatedStorage.Speed:FireServer(16)
17    end
18end)

And here is the ServerScript:

01game.ReplicatedStorage.Animator.OnServerEvent:Connect(function(player, anim, isMovement)
02    print("porg")
03    local animator = player.Character:FindFirstChild("Humanoid"):FindFirstChildOfClass("Animator")
04    local anon = animator:LoadAnimation(anim)
05    print("1")
06    if isMovement == true then
07        anon.Priority = 'Movement'
08        anon:Play()
09    else
10        anon:Play()
11    end
12    game.ReplicatedStorage.AnimatorStop.OnServerEvent:Wait()
13    anon:Stop()
14end)

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