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: Auto fire not working correctly

Previous Thread :: Next Thread 
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
22 Aug 2015 02:20 PM
m.Button1Down:connect(function()
for _, v2 in pairs(plr.Character:GetChildren()) do
if guns[v2.Name] and not reloading and v2.Ammo.Value > -1 then
mdown = true
if guns[v2.Name]["GunType"] == "Auto" then
while mdown and not reloading and not db and v2.Ammo.Value >= -1 do
wait(guns[v2.Name]["Firerate"]/10)
shotsfired = shotsfired + .2
fire(v2, m.Hit.p)
v2.Handle.Fire:Play()
end
else
shotsfired = shotsfired + .2
fire(v2, m.Hit.p)
v2.Handle.Fire:Play()
end
elseif guns[v2.Name] and v2.Ammo.Value <=0 and v2.Mags.Value == 0 then
script.Sound:Play()
end
end
end)

m.Button1Up:connect(function()
mdown = false
end)

fire is irrelevant, it just creates the ray.

When firing an automatic gun, if I were to spam click and then hold down, the firing would be incredibly fast.



JumbleBee5 wrote at 4/10/2014 11:39 AM Report Abuse nice yolks honey ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)
Report Abuse
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
22 Aug 2015 02:21 PM
never mind, i seem to of fixed it.

JumbleBee5 wrote at 4/10/2014 11:39 AM Report Abuse nice yolks honey ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)
Report Abuse
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
22 Aug 2015 07:28 PM
never mind, it's not working. same problem

JumbleBee5 wrote at 4/10/2014 11:39 AM Report Abuse nice yolks honey ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)
Report Abuse
lokkut is not online. lokkut
Joined: 18 Mar 2009
Total Posts: 1794
22 Aug 2015 07:29 PM
local mdown = false
mouse.Button1Down:connect(function()
mdown = true
repeat
shoot()
until mdown == false
end)

mouse.Button1Up:connect(function()
mdown = false
end)
Report Abuse
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
22 Aug 2015 07:38 PM
literally the same thing but with a different loop.

JumbleBee5 wrote at 4/10/2014 11:39 AM Report Abuse nice yolks honey ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)
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