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 » Game Design
Home Search
 

Gun fires multiple times after deselect & reselect

Previous Thread :: Next Thread 
xWOWZABOYx is not online. xWOWZABOYx
Joined: 05 Aug 2010
Total Posts: 2689
17 Nov 2014 03:57 PM
I'm making my own weapon system as a bit of a project, but I've run into a problem (evidently).

If you deselect and reselect the weapon, then when you click the function to fire the weapon runs multiple times (the number of times you've reselected the weapon) in one instance. Does anyone have any ideas as to how to stop this?

【◄[ϟ]〓☜✪ xWOWZABOYx; FCOM, SQN COM, Scientist, Veteran, Visionary ✪☞〓[ϟ]►】
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
17 Nov 2014 04:01 PM
You are connecting events every time you select it I'm guessing.
Report Abuse
MemoryAddress is not online. MemoryAddress
Joined: 20 Apr 2013
Total Posts: 1297
17 Nov 2014 04:02 PM
Unfortunately we're not omniscient (or even clairvoyant), and as such have no idea what your code looks like, and as such have no way of knowing what even causes this, much less how to fix it .
Report Abuse
xWOWZABOYx is not online. xWOWZABOYx
Joined: 05 Aug 2010
Total Posts: 2689
17 Nov 2014 04:07 PM
Pig assumes correctly. It's the only way I can think of doing it (other scripts I've seen do similar things).

Basically, it looks like this:

function fire(*args)
--boom boom pow
end

tool.Equipped:connect(function(mouse)
mouse.Button1Down:connect(fire)
end)

【◄[ϟ]〓☜✪ xWOWZABOYx; FCOM, SQN COM, Scientist, Veteran, Visionary ✪☞〓[ϟ]►】
Report Abuse
xWOWZABOYx is not online. xWOWZABOYx
Joined: 05 Aug 2010
Total Posts: 2689
17 Nov 2014 04:11 PM
I thought about doing something like

equipped = false

mouse.Button1Down:connect(function(*args)
if equipped then
--boom boom pow
end
end)

tool.Equipped:conenct(function(mouse)
equipped = true
end)

tool.Unequipped:conenct(function(mouse)
equipped = false
end)

but mouse is nil :/

【◄[ϟ]〓☜✪ xWOWZABOYx; FCOM, SQN COM, Scientist, Veteran, Visionary ✪☞〓[ϟ]►】
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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