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.
You could check if the player is on the correct team in the toggle button event:
button.MouseButton1Down:Connect(function()
-- if player is on right team
-- display overhead gui
end)
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.
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.
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.
local allowedUsernames = {"chrisfs123", "someotherperson"}
if table.find(allowedUsernames, game:GetService("Players").LocalPlayer.Name) then
-- show GUI
end
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.
local players = game:GetService("Players")
local teams = game:GetService("Teams")
players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
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
end
end)
end)
If you already have an overhead Gui system in place then all you need to do is something like in the above.