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
 

debounce help

Previous Thread :: Next Thread 
StrikerBOY606 is not online. StrikerBOY606
Joined: 25 Oct 2010
Total Posts: 747
05 May 2013 03:38 PM
I read the ROBLOX wiki on debounce and it still doesn't work! It still prints out the message like several time!

Wiki page: http://wiki.roblox.com/index.php/Debounce

[script]

local deb = false
script.Parent.Touched:connect(function(tch)
if not deb then
deb = true
script.Parent.Taken.Value = true
print("Value is true")
deb = false
end
end)
Report Abuse
TheGamer101 is not online. TheGamer101
Joined: 14 Feb 2009
Total Posts: 11943
05 May 2013 03:40 PM
You change the debounce back to false at the end.

local deb = false
script.Parent.Touched:connect(function(tch)
if not deb then
deb = true
script.Parent.Taken.Value = true
print("Value is true")
---removed deb = false
end
end)
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
05 May 2013 03:47 PM
local deb = false
script.Parent.Touched:connect(function(tch)
if not deb then
deb = true
script.Parent.Taken.Value = true
print("Value is true")
wait(5)
deb = false
end
end)
Report Abuse
StrikerBOY606 is not online. StrikerBOY606
Joined: 25 Oct 2010
Total Posts: 747
05 May 2013 03:49 PM
Here is my full script:

When the player is touching the brick it will change a boolValue located inside the brick to true. When the leave the brick it will change the value to false.

local deb = false
script.Parent.Touched:connect(function(tch)
if not deb then
deb = true
script.Parent.Taken.Value = true
print("Value is true")
deb = false
end
end)

local deb = false
script.Parent.TouchEnded:connect(function(tch)
if not deb then
deb = true
script.Parent.Taken.Value = false
print("Value is false")
deb = false
end
end)
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
05 May 2013 03:57 PM

local deb = false
script.Parent.Touched:connect(function(tch)
if not deb then
deb = true
script.Parent.Taken.Value = true
print("Value is true")
wait(5)
deb = false
end
end)

local deb = false
script.Parent.TouchEnded:connect(function(tch)
if not deb then
deb = true
script.Parent.Taken.Value = false
print("Value is false")
wait(5)
deb = false
end
end)
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