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

How are you to make a block, your teamcolor's color?

Im making a laser tag on roblox and I've encountered a issue on the way, I tried making it so I didnt need to spell out each teams words, so then I tried doing:

Debounce = false

plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)

teamcolor = plr.TeamColor

for i,v in pairs(script.Parent:GetChildren()) do
	if v:IsA("BasePart") then
		v.BrickColor = BrickColor.new(teamcolor)
		v.Touched:connect(function(hit)
	if Debounce == false and hit.Name == "Laser" then
		Debounce = true
		if teamcolor == game.Teams["1"].TeamColor then
		game.Workspace.num_2.Value = game.Workspace.num_2.Value + 1
elseif teamcolor == game.Teams["2"].TeamColor then
		game.Workspace.num_1.Value = game.Workspace.num_1.Value + 1
		end
end
	end)
	end
	end

But it came out as a error, as what it should do, which is it requires Color3, but how am I gonna put my teamcolor variable on a color3 function.

1 comment

0

if plr.Team == TEAM?

1 answer

✓ Accepted answer

This is what you're doing wrong.

"BrickColor.new(teamcolor)"

You see, teamcolor is already a BrickColor. This means you can just do

v.BrickColor=teamcolor

What you can also do is this

v.BrickColor=BrickColor.new(teamcolor.Color)

Hope I helped :)

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