If I give someone the keycard and he has it in the backpack I want a brick to change the color into red, and if nobody has the keycard change the brick color to green.
COMMUNITY QUESTION
How can I change the color of a brick if someone has a keycard in his backpack?
1 answer
Do that like this:
local brick = script.Parent -- Verification brick that changes colors
local p = game.Players:GetPlayerFromCharacter(brick)
while true do
wait()
if p then
if p.Backpack:FindFirstChild("Keycard") ~= nil then
brick.BrickColor = Color3.fromRGB(0,255,0) -- Make it green
wait(3)
brick.BrickColor = Color3.fromRGB(255,0,0) -- Make it red
end
end
end
Something like that I believe.
4 comments
0
I'm using the script and I gave myself the keycard and the color doesn't change :/
0
BrickColor.new() in lines 7 and 9? Try that.
0
It doesn't work, also it marks the = in red like an error, I have brick.BrickColor.new() on both lines
0
brick.BrickColor = BrickColor.new()
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
You are explaining stuff really bad, try to get us in your shoes we have no idea on what you are talking about.
Share your script what isn't working, we'll help you as possible!