using getpropertychangedsignal to detect when the players team changes makes it fire twice
for example, someone is on team A and they switch to team B.
Player:GetPropertyChangedSignal('Team'):Connect(function() --runs twice cuz it removes a team and changesit
if Player.Team == Teams:WaitForChild("teamA") then
end
if Player.Team == Teams:WaitForChild("teamB") then
--this fires twice
end
I don’t really see how this is an issue since you are doing only checks inside the function which isn’t affected upon the function firing multiple times.
Player:GetPropertyChangedSignal('Team'):Connect(function()
print('teamchanged')
if Player.Team == Teams:WaitForChild("ppl") then
ActivateScripts("Survivor")
elseif Player.Team == Teams:WaitForChild("mmmonster") then
ActivateScripts("Monster")
elseif Player.Team == Teams:WaitForChild("spectators") then
ActivateScripts("Spectator")
end
end)
the ActivateScripts() function runs twice which is the problem, and its not a problem with the function; if i remove the function and just put a print() it will still print twice