Okay so uhh im not exactly trying to have a gui appear if a player’s on a team because i already have that script but im trying to make it so. A gui appears if a players on a team “Team2” but make a different one appear if hes on team “Team1” but it doesn’t work. Why?
game.Players.PlayerAdded:Connect(function(player)
local ClickDetector = script.Parent
ClickDetector.MouseClick:Connect(function()
for _, p in ipairs(game.Players:GetPlayers()) do
if player.Team.Name == "Team2" then
local PGui = p.PlayerGui
PGui.ExplosionGui.Enabled = true
else
player.PlayerGui.DenyGui.Enabled = true
end
end
end)
end)
local ClickDetector = script.Parent
ClickDetector.MouseClick:Connect(function(player)
if player.Team.Name == "Team2" then
player.PlayerGui.ExplosionGui.Enabled = true
else
player.PlayerGui.DenyGui.Enabled = true
end
end)
Yeah uh, whenever a player spawns, everything from startergui gets copied to playergui i suggest you add the gui from a script if you dont want it to add as soon as the player join