Hello,
I get the problem. I trying to catch the playermodule other player from localscript on other player.
I’m just trying to turn off the controls of another player.
I use a tool on start that’s how i get a other player.
My error is PlayerScripts is not a valid member of Player “Players.Player1” and i know the player can’t see the other player’s script but i need to get it. How can i disable this controls player?
Script:
local player = script.Parent.Parent.Parent
local remote = game.ReplicatedStorage.zakuc
script.Parent.Part.Touched:Connect(function(ppl)
local hum = ppl.Parent:FindFirstChildOfClass('Humanoid')
local plr = game.Players:GetPlayerFromCharacter(ppl.Parent)
if ppl.Parent ~= nil and hum~= nil then
player.PlayerGui.Kajdanki.Enabled = true
remote:FireClient(player,plr)
end
end)
LocalScript
local remote = game.ReplicatedStorage.zakuc
local de = false
script.Parent.MouseButton1Click:Connect(function()
remote.OnClientEvent:Connect(function(plr)
local PlayerModule = require(plr.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
if not de then
de = true
Controls:Disable()
else
de = false
Controls:Enable()
end
end)
end)
Thanks for help