Hi, pretty much what the title says. I want to have a GUI but only give it to people who spawn onto a certain team (for instance you go on police team it gives you a police gui etc…)
I’m not really sure how to start with this: any help is appreciated
You can copy and paste the GUI from the server and into the player’s PlayerGui.
local Players = game:GetService("Players")
local TeamColor = BrickColor.new("color") -- change this
local Gui = path.to.gui -- change this
local function PlayerAdded(plr)
local playerGui = plr:WaitForChild("PlayerGui")
if plr.TeamColor == TeamColor then
local copy = Gui:Clone()
copy.Parent = playerGui
end
end
Players.PlayerAdded:Connect(PlayerAdded)
for _, plr in ipairs(Players:GetPlayers()) do
spawn(function() PlayerAdded(plr) end)
end
EDIT: Oh actually JigglyWiggles has a better solution using teams. But instead of putting the GUI into the PlayerGui by default and then making it visible, paste it into their PlayerGui.