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

IntValue isn't equal to this other IntValue?

Asked by
Mr_Unlucky 1085 Moderation Voter
5 years ago

So basically, I'm making a gun. When you're out of bullets and you reload, the bullet value is equal to the maximum amount of bullets. However, even though it does do the animation and stuff, it doesn't refill your bullets. There's no errors either. Any help?

function onKeyPress(actionName, userInputState, inputObject)
    if userInputState == Enum.UserInputState.Begin and Reloading == false then
        Reloading = true
        ReloadSound:Play()
        PlayAnimation:FireServer(ReloadAnimation)
        wait(3)
        Bullets.Value = MaxBullets.Value
        Reloading = false
    end
end

game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.R)

The code above is the reloading segment.

0
Try : Bullets.Value = Bullets.Value + MaxBullets.Value Simulants 52 — 5y
0
I've tried it before. It wont work. Mr_Unlucky 1085 — 5y

1 answer

Log in to vote
0
Answered by
gullet 471 Moderation Voter
5 years ago
Edited 5 years ago

Print your values to see what they are

print("bullets: " .. Bullets.Value)
print("max: " .. MaxBullets.Value)
0
Isn't printing, and should be a comment. Mr_Unlucky 1085 — 5y
0
If it's not printing, it's not running. Check to see if the script is running at all. If it's not it's either misplaced or disabled. gullet 471 — 5y
Ad

Answer this question