I’m currently creating sort of a Red v.s. Blue game. The !team command I designed is supposed to team any target player and then load the target’s character for them. For example, if I said !team urdadcaleb red, it would team them to the red team. That part works perfectly fine, but for some reason, the player does not actually spawn at the Red Team spawner until I’ve reset myself multiple times. I’ve connected the correct TeamColor for each spawner, but it doesn’t immediately spawn me at the correct spawner and it will take multiple resets before it realizes that I’ve been teamed and need to spawn at the correct one.
Is this a debounce issue, or is my code errored?
Problem: https://gyazo.com/81b4e6dba4c4a02d09cd25199f34509a
My code:
local args = msg:split(" ")
if args[1]:lower() == "!team" then
local target = GetPlayerFromAbbreviation(args[2])
local team = GetTeamFromAbbreviation(args[3])
if args[2]:lower() == "me" then
if team then
player.Team = team
player:LoadCharacter()
end
else
if target then
if team then
target.Team = team
target:LoadCharacter()
end
end
end
end
end)