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 » Scripters
Home Search
 

Re: equip event runs twice?

Previous Thread :: Next Thread 
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
02 Jan 2016 08:13 PM
hello there, i have a tool that keeps calling the equipped event twice even though there is only one event for equipped. the reason why i know it's calling the event twice is because i printed a message in the output. the same message prints twice when i equip the tool.
can anyone tell me what is going on here?
Report Abuse
jmt99 is not online. jmt99
Joined: 27 Jul 2008
Total Posts: 4799
02 Jan 2016 08:15 PM
lag.


debounce it.


debounce example:

local debounce = false
TOOL.Equipped:connect(function()
if (debounce == false) then
debounce = true
--code
debounce = false
end
end)


#code --jmt99
Report Abuse
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
02 Jan 2016 08:21 PM
i already did a debounce and it still runs the code inside of the debounce. and i don't think it's lag if i'm doing this in studio mode. the client and server are combined in studio mode. so its not lag.
Report Abuse
jmt99 is not online. jmt99
Joined: 27 Jul 2008
Total Posts: 4799
02 Jan 2016 08:24 PM
Then I have no clue. You must be firing the event twice somehow if it's not a debounce problem.


#code --jmt99
Report Abuse
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
02 Jan 2016 08:28 PM
i tried this with my tool and it still printed twice:

-- CODE --
local Tool = script.Parent
local debounce = false

Tool.Equipped:connect(function()
if debounce == false then
debounce = true
print("Tool Equipped")
debounce = false
end
end)

-- OUTPUT--
Tool Equipped
Tool Equipped
Report Abuse
greedyawesomeman is not online. greedyawesomeman
Joined: 18 Apr 2010
Total Posts: 1038
02 Jan 2016 09:05 PM
That printed once for me. Odd.
Report Abuse
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
02 Jan 2016 09:07 PM
btw, i'm using a local script. but that shouldn't mattter
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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