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

GUI not popping up on the command ?

Hello, I am trying to make a command that makes a Menu GUI pop up, I made the script but I am not sure why it's not working, any help would be greatly appreciated.

local GroupID = 7000168
local MinimumRank = 5
local Menu = game.StarterGui.ScreenGui.Menu

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message)
		if Player:GetRankInGroup(GroupID) >= MinimumRank then
			if Message == "!Menu" then
				Menu.Visible = true
			end
		end
	end)
end)

2 answers

✓ Accepted answer

You need to get the GUI from the Player's PlayerGui instead of the StarterGui. When a player joins the game everything inside of StarterGui will replicate to the player's PlayerGui. So you need to get the GUI from the player's PlayerGui and make changes to it from there so the player can actually see it.

local GroupID = 7000168
local MinimumRank = 5

game.Players.PlayerAdded:Connect(function(Player)
	local PlayerGui = Player.PlayerGui
    Player.Chatted:Connect(function(Message)
        if Player:GetRankInGroup(GroupID) >= MinimumRank then
            if Message == "!Menu" then
				local ScreenGui = PlayerGui:WaitForChild("ScreenGui")
				local Menu = ScreenGui:WaitForChild("Menu")
                Menu.Visible = true
            end
        end
    end)
end)

1 comment

0

Thank you so much, I really appreciate the help!

Maybe you can change the location of the menu gui to:

local Menu = game.Players.LocalPlayer.PlayerGui.ScreenGui.Menu

1 comment

0

Thanks, but it didn't work.

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