generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Delays

Previous Thread :: Next Thread 
Distantsound is not online. Distantsound
Joined: 02 Dec 2011
Total Posts: 197
26 Jun 2012 11:31 AM
How can i write a delay for an ontouch script?
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
26 Jun 2012 11:31 AM
Use wait(time)
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
26 Jun 2012 11:32 AM
This is an extremely vague question.

You mean something like this?

    basePart.Touched:connect(function(hit)
        wait(5) --Delay for 5 seconds.
        --code
    end)
Report Abuse
Distantsound is not online. Distantsound
Joined: 02 Dec 2011
Total Posts: 197
26 Jun 2012 11:34 AM
No. something liket this:

function onTouch(hit)
--code
end
wait(1)
Part.Touched:connect(onTouched)
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
26 Jun 2012 11:35 AM
Huh?
Report Abuse
Distantsound is not online. Distantsound
Joined: 02 Dec 2011
Total Posts: 197
26 Jun 2012 11:36 AM
The delay is after the function/event happens
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
26 Jun 2012 11:37 AM
Oh, you mean before the .Touched event fires again?

You don't make much sense.
Report Abuse
Distantsound is not online. Distantsound
Joined: 02 Dec 2011
Total Posts: 197
26 Jun 2012 11:38 AM
a.k.a. you need to wait a bit until you can touch the brick again. like for example: you touch a brick and something turns invisible.you touch it again and nothing happens because you need to wait until the delay is over
Report Abuse
Distantsound is not online. Distantsound
Joined: 02 Dec 2011
Total Posts: 197
26 Jun 2012 11:39 AM
YES thats exactly what i mean
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
26 Jun 2012 11:39 AM
    local deb=false

    basePart.Touched:connect(function(hit)
        if not deb then
            deb=true

            --Code

            wait(5)
            deb=false
        end
    end)
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
26 Jun 2012 11:43 AM
Oh I get what You meant now,

DEBOUNCE!
Report Abuse
Distantsound is not online. Distantsound
Joined: 02 Dec 2011
Total Posts: 197
26 Jun 2012 11:43 AM
Thanks
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image