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 » Scripting Helpers
Home Search
 

Re: Some reason my gun keeps shooting doubles

Previous Thread :: Next Thread 
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
30 Jan 2013 11:55 PM
The gun keeps shooting 2x the desired amount of times to be shot.

local fullauto=true
local firerate=0.03
local speed=1500 --Must be lower than "Distance"
local distance=2000 --Maximum distance
local bullets=5 --How many bullets are shot at once. Must be a whole number.
local damage=35
local bpmag=32 --Bullets per current magazine.
local mags=5 --How many magzines
local recoil=true --True/false to toggle if recoil is on or not.
local power=1 --A whole number between 1 and 10 for if the recoil is true. How far offset the camera is.
local gravity=true --If enabled, gravity effects the bullets.
--[[The unit of measure being used is: 1 Stud = 9.8 cm
980 CM/Second drop
24.5 studs/1 second (Including lift and aesthetical appeal.)]]

local maxammo=bpmag
local maxmag=mags
local mousedown=false
local debounce=false
local bulletsfired=0

function fire(h)
if not debounce then
bulletsfired=bulletsfired+1
print("Fired"..bulletsfired)
Wait(firerate)
end
end

function mouseDown(mouse) -----------------------------------------Possibly where the issues are
mousedown=true
if mouse~=nil then
if not fullauto then
for i=1, bullets do
fire(mouse.Hit)
end
debounce=true
Wait(firerate)
debounce=false
elseif fullauto then
repeat
for i=1, bullets do
fire(mouse.Hit)
end
debounce=true
Wait(firerate)
debounce=false
until mousedown==false
end
end
end

function mouseUp()
mousedown=false
end

script.Parent.Equipped:connect(function(m)
m.Button1Down:connect(function() mouseDown(m) end)
m.Button1Up:connect(mouseUp)
end)

script.Parent.Unequipped:connect(function()
mouse=nil
end)

Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
31 Jan 2013 12:00 AM
the function fire is added two times in the script
Report Abuse
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
31 Jan 2013 12:05 AM
ehmm.. Where?
Report Abuse
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
31 Jan 2013 12:51 AM
. .
Report Abuse
Raphael7 is not online. Raphael7
Joined: 03 Dec 2008
Total Posts: 2479
31 Jan 2013 01:25 AM
enabled = false
reloadTime = 0.25

script.Parent.Equipped:connect(function(m)
m.Button1Down:connect(function() if enabled then return end enabled = true mouseDown(m) wait(reloadTime) enabled = false end)
m.Button1Up:connect(mouseUp)
end)

script.Parent.Unequipped:connect(function()
mouse=nil
end)

-- Does this solve it?
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
31 Jan 2013 03:22 AM
[ Content Deleted ]
Report Abuse
IamAwesome777 is not online. IamAwesome777
Joined: 18 Jul 2011
Total Posts: 2640
31 Jan 2013 03:26 AM
obvious free model is obvious.

[ Content Munched ]
Report Abuse
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
31 Jan 2013 02:47 PM
@Trioxide - Because so many free models create prints as their firing. No. I planned to make it so that I can distribute it as a free model.
Report Abuse
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
31 Jan 2013 02:49 PM
Same to Iam.
Report Abuse
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
31 Jan 2013 02:51 PM
Oh, and to go along with said accusation, please direct me to the free model which uses this code? Oh. You say that you cannot find one with these settings?

Look in my inventory. The only two models of mine that aren't made by this account are Ball Terrain (Which was made by me on a previous account) and the model by Causticity, which I took because he said it would help me figure out meta tables. However, I am still quite clueless with them.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
31 Jan 2013 02:55 PM
That code hurts my eyes.

- thedestroyer115
Report Abuse
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
31 Jan 2013 02:56 PM
Of course, people come here to criticize the code instead of help it. Congrats, y'all certainly belong in this forum subsection. (Sarcasm is leaking from this post, in case you can't get that.)
Report Abuse
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
31 Jan 2013 02:58 PM
@thedestroyer- Based on the fact that you neglect to finish your games wholly, and the ones you do are quite frankly... Poorly made? I couldn't assume your code or work on ROBLOX is much better anyways.
Report Abuse
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
31 Jan 2013 03:00 PM
Also, all of your models are fairly basic.

No, I'm not trying to insult you. I'm trying to prove that you have no room to insult me.
Report Abuse
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
31 Jan 2013 03:06 PM
Also, to shine a further light on the fact that this is not a free model... Look at my places. None of the stuff used in them are found in free models, unless published by me.

I am simply a mediocre (at best) scripter looking for help.

So, rather than posting the pointless replies of "Obvious fm is obvious" etc. How about you actually do what this forum is for and help me? Because it is obviously not a free model with the overwhelming things I used to support this.

Also, lay off of the insults to the code. Not only is this a rough draft of my script, but like I said. Mediocre.
Report Abuse
m27frogy is not online. m27frogy
Joined: 26 Mar 2009
Total Posts: 4427
31 Jan 2013 03:11 PM
Since no one has the thoughtfullness to help a poor soul in need, I'll help. The reason for your dillema may lie in ROBLOX's little Equipped glitch, simply put, it fires multiple times. I usually use a debounce to eat the other times the Equipped event fires for dinner. If you need me to post up a modified script with my debounce in there, feel free to tell me.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
31 Jan 2013 03:14 PM
@freerunner
So many people misjudge me by my models, they think that that's my standard. But no, it is for helping people, not personal achievement.

- thedestroyer115
Report Abuse
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
31 Jan 2013 03:17 PM
Well, your standard still needs raised. Insults don't help. They only bring you retaliation, which is exactly what happened.
Report Abuse
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
31 Jan 2013 03:18 PM
Thank you, m27
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
31 Jan 2013 03:23 PM
I can see this being based off a free model, but not fully. The beginning.. The force and stuff all part of the free model. I don't see it anywhere using Velocity or a Body. I also don't see it firing a bullet.. not one place do I see rays or lerping.

I can't script better than you.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
31 Jan 2013 03:26 PM
"Standard."
Tell me, what is my current standard?

- thedestroyer115
Report Abuse
DragoonGuy is not online. DragoonGuy
Joined: 07 Aug 2009
Total Posts: 1062
31 Jan 2013 03:51 PM
This is happening to a lot of events, it seems. Even the "Welcome to ROBLOX building" place is suffering form 'double-delete' syndrome.

I'd try to implement some kind of denounce mechanism if I were you.
Report Abuse
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
31 Jan 2013 04:21 PM
@destroyer - You said it yourself. Helping around the forums. And you so obviously are horrible at it if you think yourself too great to read a little bit of messy code.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
31 Jan 2013 04:33 PM
I created that several months ago, and it is now updated.
Report Abuse
freerunner1234 is not online. freerunner1234
Joined: 23 Nov 2008
Total Posts: 2078
31 Jan 2013 04:44 PM
Created what?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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