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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 02 Jan 2016 09:05 PM |
| That printed once for me. Odd. |
|
|
| Report Abuse |
|
|
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 |
|
|