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

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

Asked by 6 years ago

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.

0
`if plr.Team == TEAM`? TheeDeathCaster 2368 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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 :)

Ad

Answer this question