Hello everyone, I’m currently working on an animation module and I want to stop movement and jumping while animations are playing. After much consideration, I’ve decided not to set walkspeed and jumppower to 0 (as this approach has potential risks in the future). Instead, I am using the method Controls:Disable(). However, I’m encountering an issue. If I press the W key and then disable and re-enable controls, the character will not move even though I’m still pressing the W key. I have to release and press the W key again for it to work. This can be quite awkward for players, especially when animations play frequently. Does anyone have a solution to this?
Here is part of the local script:
– Client Script
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local ControlPlayerMovement = ReplicatedStorage:WaitForChild(“ControlPlayerMovement”)
local PlayerModule = require(game:GetService(“Players”).LocalPlayer.PlayerScripts:WaitForChild(“PlayerModule”))
local Controls = PlayerModule:GetControls()
ControlPlayerMovement.OnClientEvent:Connect(function(action)
if action == “disable” then
Controls:Disable()
elseif action == “enable” then
Controls:Enable()
end
end)