im making a puzzle game and one of the main things is putting a part on a buton to open a door. i made a simple script that changes the button's color when you put the part on it.
script.Parent.Touched:connect(function(hit) if hit.Name == "qb" then script.Parent.BrickColor = BrickColor.new("Really red") end end)
how do i make it so that the color changes back when thepart stops standing on the button? i will change the color changing into opening doors later.
Here is how you can use invalidinvoke's suggestion TouchEnded
event
script.Parent.Touched:connect(function(hit) if hit.Name == "qb" then script.Parent.BrickColor = BrickColor.new("Really red") script.Parent.TouchEnded:Connect(function(HitEnd) --do stuff end end)
Hope this helps!!