I have a question on how to change the color of a part while my door is open and the turn back to normal when the door closes.
This is what I already have to open/close the door and it works but I want to add in a line that changes the color of a part names:"indicatorlight" to turn green when the door is open and red when the door is closed.
script.Parent.Touched:Connect(function(hit) if hit.Parent.Name == "KeyCard" then game.Workspace.Corridor.KeyCardDoor.CanCollide = false game.Workspace.Corridor.KeyCardDoor.Transparency = 1 wait(2.5) game.Workspace.Corridor.KeyCardDoor.CanCollide = true game.Workspace.Corridor.KeyCardDoor.Transparency = 0 end end)
Please help.
script.Parent.Touched:Connect(function(hit) debounce = false --Prevents the door being opened whilst its already open. if hit.Parent.Name == "KeyCard" then if debounce == false then debounce = true game.Workspace.Corridor.KeyCardDoor.CanCollide = false game.Workspace.Corridor.KeyCardDoor.Transparency = 1 game.Workspace.Corridor.KeyCardDoor.Color = BrickColor.Green() wait(2.5) game.Workspace.Corridor.KeyCardDoor.CanCollide = true game.Workspace.Corridor.KeyCardDoor.Color = BrickColor.Red() game.Workspace.Corridor.KeyCardDoor.Transparency = 0 wait() debounce = false end end end)
If this helped, don't forget to accept the answer!