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

Why does my button that turns a model to the color of you team not work?

Asked by
jacobwow 140
10 years ago

I am trying to make a button that turns the model Base2 the color of your team. However the script did not work. When a player from the team Teal Terrorists touches the button Base2 turns Bright bluish green but when the team Operation Orange touches the button, it does not turn Bright orange, it stays the same. What is wrong?

var1 = true
function onTouch(part)
    local humanoid = part.Parent:FindFirstChild("Humanoid")
    if humanoid ~= nil then
        if var1 == true then
        local tColor = Game:GetService("Players"):GetPlayerFromCharacter(part.Parent).TeamColor
        print("tColor: " .. tColor.Name)
            wait(.5)
            for i, v in pairs(game.Workspace.Base2:GetChildren()) do
                v.BrickColor = tColor --Whatever color you want it to change inside the parenthesis
            end
            var1 = false
        elseif var1 == false then
            wait(.5)
            for i, v in pairs(game.Workspace.Base2:GetChildren()) do
                v.BrickColor = tColor --I'm not sure if you wanted to change both to the team color?
            end
            var1 = true
        end
    end
end
script.Parent.Touched:connect(onTouch)

1 answer

Log in to vote
0
Answered by
Sublimus 992 Moderation Voter
10 years ago

print("tColor: " .. tColor.Name) This part would error because tColor is a BrickColor value. Just have print("tColor:"..tColor)

0
I was about to answer e.e, But nice answer. HexC3D 830 — 10y
0
Lol, I know how that feels, but yeah, thanks. :) Sublimus 992 — 10y
Ad

Answer this question