I have made these two functions in my module script.
function moonlightFramework.disableControls(player)
local PlayerModule = require(game.Players.player.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
Controls:Disable()
end
function moonlightFramework.enableControls(player)
local PlayerModule = require(game.Players.player.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
Controls:Enable()
end
Now, when I try run the functions in my server sided script, which is below, I get an error of player is not a valid member of Players "Players"
Server Script:
local moon = require(8288681721)
moon.disableControls(game.Players:WaitForChild("callmehSpear"))
I believe the rror has something to do with local PlayerModule = require(game.Players.player.PlayerScripts:WaitForChild("PlayerModule"))
function moonlightFramework.disableControls(player)
local PlayerModule = require(game.Players.[player].PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
Controls:Disable()
end
function moonlightFramework.disableControls(player)
local PlayerModule = require(game.Players[player].PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
Controls:Disable()
end
local moon = require(8288681721)
wait(5)
moon.disableControls(game.Players:WaitForChild("callmehSpear"))
Module Script:
function moonlightFramework.disableControls(player)
local PlayerModule = require(game.Players[player].PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
Controls:Disable()
end
function moonlightFramework.enableControls(player)
local PlayerModule = require(game.Players[player].PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
Controls:Enable()
end
All the other functions I made like kick, API, point system still work.
function moonlightFramework.disableControls(player)
local PlayerModule = require(game.Players[player.Name].PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
Controls:Disable()
end
or just
function moonlightFramework.disableControls(player)
local PlayerModule = require(player.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
Controls:Disable()
end