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

True when you enter, false when you leave?

Asked by 8 years ago

Hi,

I want to make a thing where the if you enter the brick something will happen, and when you leave the brick it stops. Can anyone help me? Is there tutorials on YouTube, or Roblox Wiki? Thanks for reading, and helping me out. Thanks!

  • BloodySoldier2002

1 answer

Log in to vote
0
Answered by 8 years ago

In this case I would use Touched and TouchEnded.

script.Parent.Touched:connect(function(hit)
    -- Insert what happens once it touches brick
    end
end)

If you want to end it, say when they walk out of the brick, you would use this.

script.Parent.TouchEnded:connect(function(hit)
    -- Insert opositite of above. The code that will change it back
    end
end)

As you requested, you wanted to see a video or wiki article on this. I linked them both below.

Touched: http://wiki.roblox.com/index.php?title=API:Class/BasePart/Touched TouchEnded: http://wiki.roblox.com/index.php?title=API:Class/BasePart/TouchEnded

Hope this helps!

0
Thank you so much! BloodySoldier2002 10 — 8y
0
If you could please accept my answer it would be much appreciated. SirBrayden 35 — 8y
0
Oh sry, I'm new to ScriptingHelpers. Thanks again! BloodySoldier2002 10 — 8y
Ad

Answer this question