Disable Player Movement

Hello! I am trying to disable players’ movement in this local script, but an error is coming up as “attempt to index nil with ‘WaitForChild’”. Here is the code I have:

(Local Script)

local player = game.Players.LocalPlayer
local Controller = require(game.Players:GetPlayerFromCharacter(player):WaitForChild("PlayerScripts"):WaitForChild("PlayerModule")):GetControls()
Controller:Disable()

Any help is appreciated. Thanks!

Why are you using the player variable in the GetPlayerFromCharacter one? The local player has all the stuff the server does. Just do:

local player = game.Players.LocalPlayer
local Controller = require(player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
Controller:Disable()

It might work, it might not, reply with the error if it doesn’t!!

I didn’t know how else to specify which player to disable the movement for

This fixed it perfectly, thank you!

If it helped, you should mark my post as answer so other people don’t respond.