I'm making a script that removes an "open" button for a gui. It's work in progress, and I have just started making the remover part, but I can't get it to work. It is probably because I didn't properly generate a list of the players. Any help is appreciated. Thanks :)
function activate()
local player = script.Parent.Parent.Parent.Parent.Parent.Parent
local Rank = player:WaitForChild('Rank')
if player.Rank.Value == 999 then
local gamers = game.Players:GetChildren() -- Me trying to generate a table of player names
for i, v in pairs(gamers) do
v.PlayerGui.trollGui.Open.Visible = false -- Me trying to use that table to make the button disappear from everyone's screen
end
end
end
script.Parent.MouseButton1Click:Connect(activate)

3 comments
This script is local?
It's a server script. Ideally, it should affect all players on the server. I mad it as a dev command.
Oh I just noticed you added the PlayerGui. Oops.