huner2
|
  |
| Joined: 27 Apr 2008 |
| Total Posts: 1681 |
|
|
| 04 Nov 2012 09:05 PM |
I tried adding debounce. But it keeps adding more than one to the place marked.
debounce = false function onTouched(hit) debounce = true wait() if hit.Parent:findFirstChild("Humanoid") then player = game.Players:GetPlayerFromCharacter(hit.Parent) if player.AreaExplored[script.Parent.Name].Value == "Yes" then return end wait() player.AreaExplored[script.Parent.Name].Value = "Yes" player.AreaFound.Value = player.AreasFound.Value + 1 end wait(0.1) debounce = false end script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
huner2
|
  |
| Joined: 27 Apr 2008 |
| Total Posts: 1681 |
|
|
| 04 Nov 2012 09:05 PM |
Oops should be:
debounce = false function onTouched(hit) debounce = true wait() if hit.Parent:findFirstChild("Humanoid") then player = game.Players:GetPlayerFromCharacter(hit.Parent) if player.AreaExplored[script.Parent.Name].Value == "Yes" then return end wait() player.AreaExplored[script.Parent.Name].Value = "Yes" player.AreasFound.Value = player.AreasFound.Value + 1 end wait(0.1) debounce = false end script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
huner2
|
  |
| Joined: 27 Apr 2008 |
| Total Posts: 1681 |
|
| |
|
|
| 04 Nov 2012 09:08 PM |
debounce = false function onTouched(hit) if debounce ~= true then debounce = true wait() if hit.Parent:findFirstChild("Humanoid") then player = game.Players:GetPlayerFromCharacter(hit.Parent) if player.AreaExplored[script.Parent.Name].Value == "Yes" then return end wait() player.AreaExplored[script.Parent.Name].Value = "Yes" player.AreasFound.Value = player.AreasFound.Value + 1 end wait(0.1) debounce = false end script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 09:09 PM |
| You have to add a check for the value so that the debounce actually works o: |
|
|
| Report Abuse |
|
|
huner2
|
  |
| Joined: 27 Apr 2008 |
| Total Posts: 1681 |
|
|
| 04 Nov 2012 09:13 PM |
| Oh man, I must be really tired to have not remembered to put that in. Oh yeah, and, you forgot an end. |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 09:14 PM |
| Oh whoops, I always forget :| |
|
|
| Report Abuse |
|
|