How could I make it so the player can’t move when the player is walking to a point?
I believe this can be done by editing the player’s control module, but I’m not sure which script it is, and what line it’s located.
How could I make it so the player can’t move when the player is walking to a point?
I believe this can be done by editing the player’s control module, but I’m not sure which script it is, and what line it’s located.
I’ve seen this question on multiple posts, using this ContextActionService method by TheGamer101 you can temporarily disable the player’s controls:
local ContextActionService = game:GetService("ContextActionService")
local FREEZE_ACTION = "freezeMovement"
ContextActionService:BindAction(
FREEZE_ACTION,
function()
return Enum.ContextActionResult.Sink
end,
false,
unpack(Enum.PlayerActions:GetEnumItems())
)
-- To unfreeze movement:
ContextActionService:UnbindAction(FREEZE_ACTION)
The better way to do this is:
local player = game.Players.LocalPlayer
local playerModule = require(player.PlayerScripts:WaitForChild("PlayerModule"))
local controls = playerModule:GetControls()
-- To disable controls
controls:Disable()
-- To enable controls
controls:Enable()
Can’t believe I missed that!
… Anyways, thanks for this, fren!