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

Brick waiting for touch?

Asked by 8 years ago

I need a brick to wait for touch but also receive the hit argument/.

This code would just wait for touch, but receive no arguments:

Part.Touched:wait()

And this code would detect touch but not wait:

Part.Touched:connect(function(Hit)

end)

I really just need it to wait for a touch, but also get the Hit argument.

0
You want the script to, after a period of time, wait a few seconds before being able to be touched again? M39a9am3R 3210 — 8y
0
may you please specify what your asking. IF you want it to wait for a touch then use a listener. Im confused what your asking koolkid8099 705 — 8y
0
@koolkid80299 "I really just need it to wait for a touch, but also get the Hit argument." I clearly specified what I wanted. RepeatLua 90 — 8y

1 answer

Log in to vote
4
Answered by 8 years ago

The wait method of events actually does return the arguments.

local hit = Part.Touched:wait()
0
Heh, interesting. I'll have to try that out sometime. M39a9am3R 3210 — 8y
0
It's really helpful when defining character, local character = player.Character or player.CharacterAdded:wait() GrayTide 0 — 8y
Ad

Answer this question