|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|