Ok, you need to understand the basics of the Touched event in order to continue. So, first of all, you want to check if it's a humanoid that touched it, and only players and NPCs have humanoids, so you have a 50/50 chance of it being a player. And now you want to check if the humanoid is a child of the player's character, then check what team they're in, and set the team to the specified team you'd like
local Teams = game:GetService("Teams")
function Touched(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local ChangedTeam = "Prisoner"
if player.Team ~= Teams[ChangedTeam] then
player.Team = Teams[ChangedTeam]
end
end
end
end
Part.Touched:Connect(Touched)
1 comment
If Player.Team == game.Teams.Prisoner then Player.Team = game.Teams.Criminal