I have run into a problem when the script doesn’t detect when a player is on a team. I know you can find a player’s team by using a on Team Change kinda thing but I need it so the script will detect it regardless of what time the function is run. The function is run in a while true do loop with other functions (this is because I have a minigame kinda game). Any help will be appreciated. Thanks
if PlayerFromCharacter.Team == game.Teams.Lobby then
I used a print and it said the player was still on the team from the start of the game
I’m assuming you are fairly new to scripting but you can do something like this.
function ChangeTeam()
for _, player in ipairs(game.Players:GetPlayers()) do
if player.Team == game.Teams.Lobby then
--Do Stuff
end
end
end
ChangeTeam()
That is what I had already. The problem is, is that it detects the origional team that you spawn in on. I think a way to fix this is to teleport players to a part so when the part is touched the function can run.