Basically, I got the following server-side script that when the player’s team is changed, just basically detects that the team has changed, but still printing the “newTeam” as the precedent team.
Here is an image below tha explains. (btw when I change the team it’s in localscript)
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(Character)
wait(2)
local function onTeamChange(newTeam)
print(newTeam)
if plr:GetRankInGroup(17148029) == 255 and newTeam.Name == "Imperial Army" then
print("The player is in team!")
end
end
onTeamChange(plr.Team)
plr:GetPropertyChangedSignal("Team"):Connect(function()
onTeamChange(plr.Team)
end)
end)
end)
Oh, nvm. I know why, I am so dumb . I should have changed it in serverside, as when I change it in a localscript, it’s just changes locally and the server doesn’t receive any changes, sorry for that