menu
Roblox Forum Archive
Home
User Search
Forums
Donate
search
settings
Home
User Search
Forums
Donate
launch
Go to User Dashboard
Forums
Scripters
Stop a Function
chevron_left
chevron_left
chevron_left
of
1
chevron_right
chevron_right
chevron_right
Stop a Function
HatLicense
Join Date: 2015-03-16
Post Count: 330
#185909296
Wednesday, March 23, 2016 7:52 PM GMT
Is it possible to stop a function that is running in a script? For example I have an onTouched Function and I want it to run for about 5 seconds and then stop, but I don't want to have to disable the script it's in.
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
C_Sharper
Join Date: 2011-10-03
Post Count: 9405
#185910200
Wednesday, March 23, 2016 8:10 PM GMT
local r = false script.Parent.Touched:connect(function(hit) if not r then r = true wait(5) script.Disabled = true end end)
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
chevron_left
chevron_left
chevron_left
of
1
chevron_right
chevron_right
chevron_right