So, i was trying to make it so, that there’s 2 sets of GUI’s, 1 for each team and the script’s job is to prevent players from seeing/interacting with GUI meant for other team.
This is what i made(It’s LocalScript if you were wondering):
local Teams = game:GetService("Teams")
local players = game:GetService("Players")
players.PlayerAdded:Connect(function()
local plr = players.LocalPlayer
if plr.Team == Teams.Team1 then
script.Parent.Team2:Destroy()
elseif plr.Team == Teams.Team2 then
script.Parent.Team1:Destroy()
end
end)
It simply won’t work, i went wrong somewhere and no idea where, so i post this here as my last resort, since i’m out of ideas myself.
It literally says that it’s a LocalScript right above the block of code.
Edit: thank you for stating that, applying this knowledge, i came up with a solution of myself.
local Teams = game:GetService("Teams")
local players = game:GetService("Players")
players.PlayerAdded:Connect(function()
local plr = players.LocalPlayer
if plr.Team.Name == "Team1" then
script.Parent.Team2:Destroy()
elseif plr.Team.Name == "Team2" then
script.Parent.Team1:Destroy()
end
end)
I already got a working solution of my own in place, but thanks still.
Edit: Also, i tested your script, just because why not, and it doesen’t even work.