Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

0

This script is local?

0

It's a server script. Ideally, it should affect all players on the server. I mad it as a dev command.

0

Oh I just noticed you added the PlayerGui. Oops.

1 answer

✓ Accepted answer

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)

1 comment

0

smh. Thanks for pointing that out XD. I thought I had seriously messed up.

This discussion is preserved as it was. New answers, comments, and votes are closed.