You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want a message to bring a UI up. By saying !rules, the UI pops up for EVERYONE, and only ppl that’s in the rank can use it.
What is the issue? Include screenshots / videos if possible!
Above.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried making the most myself, but for some reason it won’t work, and I haven’t got any errors.
local GroupId = 6086338
local MinimumRankToUseCommand = 55
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local RulesGui = game.StarterGui.Rules.Frame
end)
local RulesGui = game.StarterGui.Rules
Player.Chatted:Connect(function(Message)
local SplitMessage = Message:split(" ")
if SplitMessage[1] == "!rules" and Player:GetRankInGroup(GroupId) >= MinimumRankToUseCommand then
RulesGui.Visible = true
end
end)
end)
-- It's located in the workspace by the way.
StarterGui will not affect the GUI on the players. You need to go to game.Players[player].PlayerGui, or is this case Player.PlayerGui.Rules.Visible = true. Also if “Rules” is a screen gui it’s enabled not visible
What you did wrong was refrence StarterGui, but every player has a PlayerGui.
game.StarterGui.Rules.Frame.Visible = true
local GroupId = 6086338
local MinimumRankToUseCommand = 55
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
Player.PlayerGui.Rules.Frame.Visible = true
end)
local RulesGui = game.StarterGui.Rules
Player.Chatted:Connect(function(Message)
local SplitMessage = Message:split(" ")
if SplitMessage[1] == "!rules" and Player:GetRankInGroup(GroupId) >= MinimumRankToUseCommand then
for i,Player2 in pairs(game:GetService("Players"):GetPlayers()) do
Player2.PlayerGui.Rules.Frame.Visible = true
end
end
end)
end)
Please do NOT mess around or interact with GUIs using the server rather do it on the client’s end.
I don’t understand why you are using player.CharacterAdded and under it have the RulesGui defined, remember that any GUIs in StarterGui that you mess with, the effects won’t replicate, all of the GUIs will replicate to the player’s PlayerGui file when they join firsthand, so you mess with those ones like @AvionicScript mentioned Player.PlayerGui
Regardless of working or not, you are only making it visible for the client that’s chatting, so you’d have to loop through all players and get their own PlayerGui and mess with the rules GUI inside it.