Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Touch change team?

Asked by 8 years ago

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

Log in to vote
2
Answered by 8 years ago

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")
Ad
Log in to vote
0
Answered by
WVPII 5
8 years ago

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)

Log in to vote
0
Answered by 8 years ago

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

Answer this question