How do I create a GUI that pops up when a command is ran?

Greetings,

I am more of a builder than a scripter within ROBLOX and I was wondering how I could make a GUI pop up for everybody when a chat command is ran? I’d like to add a time limit to each GUI aswell meaning like, every 20 seconds a different GUI pops up for everyone until it has finished presenting all of the GUIs. It sounds confusing but I quite need this feature for my game. Thanks.

1 Like

Use a local script

game.Players.PlayerAdded:Connect(function(player)
  player.Chatted:Connect(function(msg)
    -- the msg param is a string of what the player said
    -- do ui code 
  end)
end)

I suggest using #help-and-feedback:scripting-support

This should work in a local script:

local plr = game.Players.LocalPlayer -- player
plr.Chatted:Connect(function(msg) -- on a message sent by the player, run this function:
   if msg:lower() == "!gui" then-- check if the message in lower case is !gui
      plr.PlayerGui.gui.Frame.Visible = true -- set frame to visible
   end
end)

Wrote on mobile, formatting might not be the best.

Just like Dandcx said, I think u should use #help-and-feedback:scripting-support

Sorry if I’m confusing you, I’m not really a scripter so where would I put this script? And is there a way to time the GUI so it closes within around 20 seconds? Sorry if I’m asking for too much,

You can put it anywhere that’s visible to the client. I suggest StarterPlayerScripts.

To make it close after 20 seconds, simply add a wait(20 then set the visible to false. (See how I set it to true in the code.

1 Like

Thanks, and one more thing, is there a way to make it so only certain group ranks can use this command?

I suggest using Remote Events or Functions for that

An announcement-type command code requires:

  1. The sender, who typed it and fired it.
  2. The server which processes this, sanity checks and filter(it’s user-based input).
  3. Fire all clients except the sender to create this GUI.
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if plr:GetRoleInGroup(123456689) and string.lower(msg) == "jump all" then
plr.PlayerGui.MyGui.MyFrame.Visible = true
 end
end)

There you go.

1 Like