Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why does not the variable Remove the Bullets When Reloaded?

Asked by 4 years ago

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:

01wait(3)
02local Humanoid = game.Players.LocalPlayer.Character.Humanoid
03local ShootAnimation = Instance.new("Animation")
04local ReloadAnimation = Instance.new("Animation")
05ReloadAnimation.AnimationId = "rbxassetid://5593968248"
06local ReloadAnimationTrack = Humanoid:LoadAnimation(ReloadAnimation)
07 
08ShootAnimation.AnimationId = "rbxassetid://5593333395"
09 
10local ShootAnimationTrack = Humanoid:LoadAnimation(ShootAnimation)
11bullets = 9
12 
13local mouse = game.Players.LocalPlayer:GetMouse()
14local Handle = script.Parent.Handle
15local Gun = script.Parent
View all 51 lines...

Anyone know the problem? theres no errors in script

1 answer

Log in to vote
1
Answered by
Qariter 110
4 years ago

In the reload script, you forgot to increase the value of bullets back up.

1function Reload() -- Somewhere on this function stuff?
2    print("Reloading...")
3    ReloadAnimationTrack:Play()
4    wait(ReloadAnimationTrack.Stopped)
5    bullets = 9 -- Refill bullet count.
6    return
7end

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.

0
@marinhren Im sorry for the bad method. i am Just Trying a bit with Other Ideas in my head. btw everything is not done yet HKprogram 48 — 4y
0
NO I AM STUPID I FORGOT THAT SORRY @marinhren HKprogram 48 — 4y
Ad

Answer this question