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

Touch change team?

Hi I am trying to make a script that changes people team on touch but does not seem to be working for me if someone could please help.

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
Player = game.Players:GetPlayerFromCharacter(hit.Parent)
Player.TeamColor = BrickColor.new("Bright red ")
end
end)

3 answers

You have a syntax error (Fancy name for a typo essentially lol) Line 4 you have a space after red

It should be

Player.TeamColor = BrickColor.new("Bright red")

You should check they aren't already red team for efficacy

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if (Player.TeamColor ~= BrickColor.new("Bright red")) then
Player.TeamColor = BrickColor.new("Bright red ")
end
end
end)

basically u put a space in between the code part where u shouldnt... (bright red) is what you put. it should be: (brightred)

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