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
 

why does the Tool.Equipped event fire multiple times?

Previous Thread :: Next Thread 
xSIXx is not online. xSIXx
Joined: 06 Aug 2010
Total Posts: 9202
27 Oct 2012 11:11 AM
i always wondered.
Report Abuse
xSIXx is not online. xSIXx
Joined: 06 Aug 2010
Total Posts: 9202
27 Oct 2012 11:19 AM
i just used the serach function and realised i posted an answer to my question on a different thread.
Report Abuse
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
27 Oct 2012 11:24 AM
Well don't do that again! Ok?

All aboard the bandwagon.
Report Abuse
Legend26 is not online. Legend26
Joined: 08 Sep 2008
Total Posts: 10586
27 Oct 2012 11:55 AM
Link? I wonder as well.
Report Abuse
Garnished is not online. Garnished
Joined: 09 Apr 2012
Total Posts: 12695
27 Oct 2012 11:56 AM
^
Just search up Tool.Equipped fire.
Report Abuse
xSIXx is not online. xSIXx
Joined: 06 Aug 2010
Total Posts: 9202
27 Oct 2012 12:07 PM
@legend

it's because the tool gets reparented into character and the script runs again and fires the equipped event again for some reason.

easy fix:

function onToolEquip(mouse)
if tool.Parent == character then return end
character = tool.Parent
end
tool.Equipped:connect(onToolEquip)

function onToolDeEquip()
character = nil
end
tool.Unequipped:connect(onToolDeEquip)
Report Abuse
SN0X is not online. SN0X
Joined: 24 Oct 2011
Total Posts: 7277
27 Oct 2012 12:50 PM
I wouldn't rely on that "easy fix" too much.

Use debounce methods instead.
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