Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Tool that changes the team of a player?

I am making a tag like game with the tagger having a tool but i want it when the tag tool comes in contact with a player that is on the other team. that player changes teams how do i do that?

1 answer

✓ Accepted answer

Just setup the TeamName variable to match the Team you want to change the tagged person to.

--Assuming the script is directly inside the tool:

local Handle = script.Parent:WaitForChild("Handle")
local TeamName = "" -- Put name of the team between the quotes
local NewTeam = game.Teams:FindFirstChild(TeamName)

Handle.Touched:Connect(function(partHit)
	if partHit.Parent:FindFirstChild("Humanoid") and partHit.Parent ~= script.Parent.Parent then
		local Tagged = partHit.Parent
		game.Players:GetPlayerFromCharacter(Tagged).TeamColor = NewTeam.TeamColor
	end
end)

1 comment

0

Thank you very much this worked perfectly :)

This discussion is preserved as it was. New answers, comments, and votes are closed.