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

How to make it so that when a keycard touches the block it change color?

Asked by 5 years ago
Edited 5 years ago

I want to know how you would change the color of a block. Lets say i touched a block once and the color is green but i want it to stay green and then when i touch it again with the keycard it turns red so far I can only get it to change one color.....

door = script.Parent
open = false

script.Parent.Touched:Connect(function(part)
    local keycard = part:FindFirstChild("keycard")
    if keycard ~= nil and keycard.value == true and then 
        open = true
        if open ~= true then
        script.Parent.color.brickcolor = BrickColor.new("Really Red")
        else
                script.Parent.color.brickcolor = BrickColor.new("Bright Green")
    end



end)
0
.touched is deprecated use .Touched also :connect is deprecated use :Connect also for check use if keycard then also use local keycard = part.Parent:FindFirstChild("keycard") not local keycard = part:findfirstchild("keycard") also use script.Parent.color.BrickColor = BrickColor.new("Color"), if keycard is in backpack you need to get player, after check keycard in backpack/character yHasteeD 1819 — 5y
0
I edited it voidofdeathfire 148 — 5y
0
what is line 6? GoldAngelInDisguise 297 — 5y
0
anyways i messed up line 6 earlier so now I know it works thanks for the help! voidofdeathfire 148 — 5y

Answer this question