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()
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!!