|
| 01 Mar 2017 05:20 AM |
Hey all,
my script doesnt seem to work and i cant figure it out, ive tried so many different ways and none seem to work so im asking on here now.
i have cut parts out that make it long, but itas not essential to the debounce bit. here is the script (the timer is a StringValue which is why its "tonumber")
parent = script.Parent debounce = false RocketPropulsion = tostring(RocketPropulsion) timer = tonumber(script.Parent.Time.Value)
function onTouch(hit) if debounce == false then if hit.Size.x >= 4 and hit.Size.z >= 4 and hit.ClassName == "Part" then debounce = true local value = hit.Cash.Value --makes some parts wait(timer) debounce = false else if hit.Size.x >= 2 and hit.Size.z >= 2 and hit.ClassName == "Part" then if debounce == false then debounce = true local value = hit.Cash.Value
--makes some other parts wait(timer) debounce = false
end end end end end
parent.Touched:connect(onTouch)
|
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 01 Mar 2017 05:27 AM |
| what's it supposed to do. what isn't happening. |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2017 05:35 AM |
A debounce system is a set of code that keeps a function from running too many times.
so basically, i need it to stop the function from running constantly when hit, so a part comes in at 4,4,4 and it breaks down into 2 lots of 2,2,2 parts, but if it gets hit by 2 parts 4,4,4 then it breaks both of them rather then just 1 and waiting for the timer.
|
|
|
| Report Abuse |
|
|
| |
|