Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.