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)
I think I found a fix to your problem. What you did wrong was that there is no Child that the players have called trollGui. Each player has a child that's called PlayerGui. That's where the trollGui is stored. Maybe try this script.
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() for i, v in pairs(gamers) do v.PlayerGui.trollGui.Open.Visible = false --------------This is where you made your mistake so I fixed it. You just needed to add **PlayerGui** end end end script.Parent.MouseButton1Click:Connect(activate)