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

Is it possible to detect when a part is walked off of?

Asked by
Freemium 110
10 years ago

Is it possible to detect when a player gets of a part by means of jumping, walking off, etc?

1 answer

Log in to vote
6
Answered by
nate890 495 Moderation Voter
10 years ago

Use the Touched event in conjunction with the TouchEnded event:

local part = game.Workspace.Part

part.Touched:connect(function(hit)
    print(hit.Name.. " is touching ".. part.Name)
    part.TouchEnded:wait()
    print(hit.Name.. " is no longer touching ".. part.Name)
end)
0
Thank you. Freemium 110 — 10y
Ad

Answer this question