Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

:wait() as a method?

I've seen wait used as a method a few times, I was wondering if any of you can explain how this works to me. Thanks. (Note: I've only seen it used on events)

1 answer

wait() is basically telling the computer to wait until something would happen. Example:

local P = game.Workspace.Part

function onTouch(part)
	P.Transparency = 0
	wait(2) --"Oh! I see the wait symbol, that means I have to wait 2 seconds until I do something!
	P.Transparency = 1
end

--and other function stuff here 

2 comments

3

I figured it out. It's a property of roblox events. It allows you to pause the script to wait for the event itself. Example: script.Parent.Touched:Wait() Assuming that the parent is of course a part.

0

Why are people hating on your awnser?!Your awnser is fine.

This discussion is preserved as it was. New answers, comments, and votes are closed.