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: Dilemma with equipped

Previous Thread :: Next Thread 
AntiFiter is not online. AntiFiter
Joined: 14 May 2009
Total Posts: 12290
21 Mar 2015 08:48 AM
-- Equipped Function
MouseButton1Down:connect(function()
print'Running once'
end)
end) -- to the equipped function

I have a little problem. If you equip the tool and click, it prints once. If you re-equip and click, it prints twice. It runs it for each time you equip because the function never ends. How can I break this function so it will only run once in the future when you equip?
Report Abuse
AntiFiter is not online. AntiFiter
Joined: 14 May 2009
Total Posts: 12290
21 Mar 2015 01:37 PM
bump
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
21 Mar 2015 01:39 PM
That's because you are connecting it more than once, you could disconnect it but roblox says not to anymore, so you just log each time you equip it and if its the same then do the stuff,
Report Abuse
AntiFiter is not online. AntiFiter
Joined: 14 May 2009
Total Posts: 12290
21 Mar 2015 01:40 PM
My question is HOW do I disconnect it?
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
21 Mar 2015 01:42 PM
You cant anymore it errors



local equips = 0

equp event
equip +1
local curentequop=equip
click
if curentequop= equip then
end
end



Report Abuse
DogBone343 is not online. DogBone343
Joined: 09 Jan 2014
Total Posts: 6855
21 Mar 2015 01:43 PM
:break()
Report Abuse
AntiFiter is not online. AntiFiter
Joined: 14 May 2009
Total Posts: 12290
21 Mar 2015 01:47 PM
@Dog

It's just 'break'

And you can't break MouseButton1Down, you can only return. It's not a loop

I could do something like "if not equipped return end" right after the function, but that doesn't fix the problem. It will still run a new function every time you equip, which is going to get very laggy after playing for an hour.

any ideas?
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
21 Mar 2015 01:51 PM
local event

Tool.Equipped:connect(function(mouse)
event = mouse.Button1Down:connect(function()
print'Running once'
end)
end)

Tool.Unequipped:connect(function()
event:disconnect()
end)
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