So When I touch a specific part, I want the script to switch me from a team to another so I made a script that creates the team and then switches the player but the script executes twice and It says You're in the 'Base' team twice
local part = script.Parent
local function AssignBaseCamp(touchPart)
if touchPart.Parent:FindFirstChild("Humanoid") then
local newTeam = Instance.new("Team",game.Teams)
newTeam.AutoAssignable = false
newTeam.Name = "Base"
local playerInstance = game.Players:GetPlayerFromCharacter(touchPart.Parent)
if playerInstance.Team ~= newTeam then
print("Test")
playerInstance.Team = newTeam
end
end
end
part.Touched:Connect(AssignBaseCamp)```
** You are now Level 3! **

