Hello! I’m trying to disable player controls in a certain function. However, it keeps returning this error. I’m not really sure how to fix it.
if newPlr ~= player and newChar:WaitForChild('Humanoid').Health > 0 then
handleVars.curTarg = newPlr
handleVars.curTargName = newPlr.Name
tieEvent:FireServer(newPlr, 'Tie')
local Controls = require(newPlr.PlayerScripts.PlayerModule):GetControls()
Controls:Disable()
end;
if newPlr ~= player and newChar:WaitForChild('Humanoid').Health > 0 then
handleVars.curTarg = newPlr
handleVars.curTargName = newPlr.Name
tieEvent:FireServer(newPlr, 'Tie')
local PlayerScripts = newPlr:WaitForChild("PlayerScripts")
if PlayerScripts then
local PlayerModule = PlayerScripts:WaitForChild("PlayerModule")
if PlayerModule then
local Controls = require(PlayerModule):GetControls()
if Controls then
Controls:Disable()
else
warn("Controls module not found for player: " .. newPlr.Name)
end
else
warn("PlayerModule not found for player: " .. newPlr.Name)
end
else
warn("PlayerScripts not found for player: " .. newPlr.Name)
end
end```
It’s a little difficult to see from what code you’ve provided but are you trying to access a different players PlayerScripts folder?
A client can only access their own PlayerScripts folder.
You can’t access PlayerScripts through the server. Only the client that the PlayerScripts folder belongs to has access to it since it’s an instance made by their respective clients.