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: Gun Debounce

Previous Thread :: Next Thread 
DecimaPrism is not online. DecimaPrism
Joined: 28 Aug 2014
Total Posts: 95
18 Oct 2017 08:08 AM
Hello!

I'm curious if there is a better way to do my debounce for my gun...when firing, I don't want to spam the mouse and have it end up firing a barrage.

I'm pretty dumb, thanks for the help!

Mouse.Button1Down:connect(function()
if Active == true and Ammo > 0 and Firing == false and GlobalDebounce == true then
GlobalDebounce = false
Dead()
Firing = true
while Firing == true and Ammo > 0 do
Singlefire()
wait(FireRate/60)
end
end

if Active == true and Ammo <= 0 then
tool.MuzzleFlash.Smoke.Enabled = true
Empty:Play()
Firing = false
end
wait(2)
GlobalDebounce = true
end)

Mouse.Button1Up:connect(function()
Firing = false
end)
Report Abuse
DecimaPrism is not online. DecimaPrism
Joined: 28 Aug 2014
Total Posts: 95
18 Oct 2017 08:28 AM
Bump
Report Abuse
mattscy is online. mattscy
Joined: 06 May 2011
Total Posts: 1079
18 Oct 2017 08:33 AM
is there anything wrong with the way youre doing it?
Report Abuse
DecimaPrism is not online. DecimaPrism
Joined: 28 Aug 2014
Total Posts: 95
18 Oct 2017 03:45 PM
I can click really fast and spam the shots and I was wondering if there was a different way to mitigate that.
Report Abuse
DecimaPrism is not online. DecimaPrism
Joined: 28 Aug 2014
Total Posts: 95
18 Oct 2017 07:27 PM
bump
Report Abuse
wackeyhd5cool is online. wackeyhd5cool
Joined: 24 Nov 2010
Total Posts: 906
18 Oct 2017 08:15 PM
Set up a variable so that when you fire, if this variable is greater than x, it fires, and tick() is stored as the variable's value
Report Abuse
wackeyhd5cool is online. wackeyhd5cool
Joined: 24 Nov 2010
Total Posts: 906
18 Oct 2017 08:17 PM
Whoops disregard that. Set up a variable with value tick(). When you click, see if tick() is greater than the variable. If it is, set the variable to tick() and call the function to fire the gun
Report Abuse
DecimaPrism is not online. DecimaPrism
Joined: 28 Aug 2014
Total Posts: 95
18 Oct 2017 11:34 PM
Ok I tried it. The rounds travelled very slowly..
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