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

how to make a part need to stay on a button?

Asked by 1 year ago

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.

0
You could use the TouchEnded event to accomplish this. See: https://create.roblox.com/docs/reference/engine/classes/BasePart#TouchEnded invalidinvoke 134 — 1y

1 answer

Log in to vote
0
Answered by 1 year ago

Here is how you can use invalidinvoke's suggestion TouchEndedevent

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!!

0
place it outside script.Parent.Touched NOT INSIDE T3_MasterGamer 2189 — 1y
0
Why I don't think that makes a difference theking66hayday 841 — 1y
Ad

Answer this question