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: Script glitching

Previous Thread :: Next Thread 
huner2 is not online. 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 is not online. 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 is not online. huner2
Joined: 27 Apr 2008
Total Posts: 1681
04 Nov 2012 09:08 PM
Can anyone help?
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
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 is not online. 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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
04 Nov 2012 09:14 PM
Oh whoops, I always forget :|
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