Hello.
I am making a sessions booking board for a group, and I am in very early development of it. Right now, I’m trying to make it so when you say !book , it will bring up a Gui.
Please let me know how this isn’t working. I also have no errors in the output.
Here’s the script:
Player.Chatted:Connect(function(Message)
if Player:GetRankInGroup(5974444) >= 17 then
if Message == "!book" then
game.StarterGui.ScreenGui.SessionType.Visible = true
game.StarterGui.ScreenGui.BackgroundFade.Visible = true
game.StarterGui.ScreenGui.DSL.Visible = true
game.StarterGui.ScreenGui.DSLtwo.Visible = true
end
end
end)
end)
```
You probably haven’t understood yet that the starter Gui isn’t the one showing up when a player is playing your game, the Starter Gui is used for the cloning the Stuff and is put into the player’s Player Gui.
But anyways what you should do is have a remote event hopefully, and then FireClient it with the player who typed that message, and the OnClientEvent handler should open the UI.
So Something like This, just an example:
--Server Script
local Event = <PathToEvent>
Player.Chatted:Connect(function(Message)
if Player:GetRankInGroup(5974444) >= 17 then
if Message == "!book" then
Event:FireClient(Player)
end
end
end)
--LocalScript somewhere in the client side.
local Event = <PathToEvent>
local GUI = <PathToGUI>
Event.OnClientEvent:Connect(function()
GUI.Visible = true
end)
You are changing the GAME’s starter GUI. This means that when a new player joins it will be different from others. You can simply just do player.PlayerGui instead of game.StarterGui.
Any changes made to any GUI in the StarterGui are [color=red]not[/color] replicated to the client, and/or server. The changes for it is made and actually is happening, but it is not visible due to the fact that it’s in StarterGui. Upon respawn, the GUI with the changes will be cloned to the player’s PlayerGui, a folder inside a player which all GUI instances in StarterGui are replicated to.
What was said here by now is the proper solution, this is just a tip…
The way you’re doing it now checks the player’s rank each time a player chats. This is extremely inefficient and may result in reaching the limit of API uses per server faster.
I suggest switching it up like this:
if Message == "!book" then
if Player:GetRankInGroup(5974444) >= 17 then
-- Code here
end
end