So i am making a gun. Basically im working right now on reload stuff. its done but When it reloaded i can shoot forever without More reloading. Heres the script:
01 | wait( 3 ) |
02 | local Humanoid = game.Players.LocalPlayer.Character.Humanoid |
03 | local ShootAnimation = Instance.new( "Animation" ) |
04 | local ReloadAnimation = Instance.new( "Animation" ) |
05 | ReloadAnimation.AnimationId = "rbxassetid://5593968248" |
06 | local ReloadAnimationTrack = Humanoid:LoadAnimation(ReloadAnimation) |
07 |
08 | ShootAnimation.AnimationId = "rbxassetid://5593333395" |
09 |
10 | local ShootAnimationTrack = Humanoid:LoadAnimation(ShootAnimation) |
11 | bullets = 9 |
12 |
13 | local mouse = game.Players.LocalPlayer:GetMouse() |
14 | local Handle = script.Parent.Handle |
15 | local Gun = script.Parent |
Anyone know the problem? theres no errors in script
In the reload script, you forgot to increase the value of bullets back up.
1 | function Reload() -- Somewhere on this function stuff? |
2 | print ( "Reloading..." ) |
3 | ReloadAnimationTrack:Play() |
4 | wait(ReloadAnimationTrack.Stopped) |
5 | bullets = 9 -- Refill bullet count. |
6 | return |
7 | end |
Your method of reloading is werid. Try checking for a R keypress and for mousebutton check ift's empty then reload and then be able to shoot.