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

How do I make a script reset once a brick isn't being touched?

Asked by 8 years ago

I have this but how would I make it so once the player isn't touching the brick I could make it reset back to its original color?

function onTouched(hit)
    script.Parent.BrickColor = BrickColor.new("Really red")
end

script.Parent.Touched:connect(onTouched)
0
What function would I have to use? kingstephen23 35 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

This question is so easy to answer that it's TOUCHING my heart.

1/10 for that pun.

The TouchEnded event fires when, obviously stop touching a Part

So we can use that to make it return to it's original colour.

part.Touched:connect(function(hit)
    part.BrickColor = BrickColor.new("Colour")
end)
part.TouchEnded:connect(function(hit)
    part.BrickColor = BrickColor.new("Colour")
end)
Ad

Answer this question