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

GUI not popping up on the command ?

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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)
0
Thank you so much, I really appreciate the help! shebel159 -3 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

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

local Menu = game.Players.LocalPlayer.PlayerGui.ScreenGui.Menu
0
Thanks, but it didn't work. shebel159 -3 — 3y

Answer this question