Overhead guis that you can toggle

I want to have overhead guis that you can toggle, but you can only toggle it if you are on. A certain team and have access to it.

Not sure how to make this and if it’s even possible.

I have looked it up on YT and the forum but still I have found nothing.

Now I am not asking for a script or guis but some tips or a point in a good direction and if this is even possible to make would be nice. Thanks for your help.

can’t you use if statements to check for player team

So it’s not possible? Is that what your saying?

no… im telling you how to do it/what should you use

You could check if the player is on the correct team in the toggle button event:

    -- if player is on right team
        -- display overhead gui

If you are communicating between the server and client (ie. you have the teams stored on the server, or you want the overhead gui to be visible for ALL players in the server), then you will need to use remote functions and events.

Ok… But the GUI is only for a few people.

But the GUI is only for a few people.

Yes you can filter based on whether or not they are on the right team (as you said in the original post).

Yes but let’s say there’s 3 people on team I don’t want all of them tp have the gui only let’s say chrisfs123 and I don’t want to have amprocop to have the gui toggle because the gui toggle would only be for a few people. I am a bit lost here.

Here’s how it should look like:

  • A script on the server that gives players their overhead BillboardGuis on spawn by hooking onto the Players.PlayerAdded event followed by Player.CharacterAdded event per player. [if you don’t already have the overhead GUIs set up]

  • A RemoteEvent under ReplicatedStorage for authorized clients (players) to send “toggle my overhead GUI” requests to the server.

  • A script on the server (can be in the same aforementioned script) that listens to the RemoteEvent being fired by a client. When this happens, it checks that they are on the correct team, and if so, toggles the visibility of the overhead BillboardGui located somewhere under the player’s character.

  • A GUI on the client with a button and a localscript that checks if the player is on the correct/allowed team and makes the onscreen button visible/clickable accordingly. The localscript will also fire the RemoteEvent when the button is clicked.

You can filter by player like this:

-- if player.Name equals "chrisfs123" then 
    -- show toggle gui

Or use a whitelist of some sort. For example:

local allowedUsernames = {"chrisfs123", "someotherperson"}
if table.find(allowedUsernames, game:GetService("Players").LocalPlayer.Name) then
    -- show GUI

Note, however, that user IDs instead of names would be recommended for allowing specific people, since it’s possible for anyone to change their username.

1 Like
local players = game:GetService("Players")
local teams = game:GetService("Teams")

		if player.Name == "chrisfs123" then
			--give yourself your own specific overhead gui
		elseif player.Team == teams.Red then
			--give red team players a specific overhead gui
		elseif player.Team == teams.Blue then
			--give blue team players a specific overhead gui

If you already have an overhead Gui system in place then all you need to do is something like in the above.

Where would I put the script???