Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make a gui remover script that removes the open button?

Asked by 5 years ago
Edited 5 years ago

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)
0
This script is local? DeceptiveCaster 3761 — 5y
0
It's a server script. Ideally, it should affect all players on the server. I mad it as a dev command. ZeroNoey 19 — 5y
0
Oh I just noticed you added the PlayerGui. Oops. l1u2i3 52 — 5y

1 answer

Log in to vote
0
Answered by
l1u2i3 52
5 years ago

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)

0
smh. Thanks for pointing that out XD. I thought I had seriously messed up. ZeroNoey 19 — 5y
Ad

Answer this question