Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

IntValue isn't equal to this other IntValue?

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.

2 comments

0

Try : Bullets.Value = Bullets.Value + MaxBullets.Value

0

I've tried it before. It wont work.

1 answer

Print your values to see what they are

print("bullets: " .. Bullets.Value)
print("max: " .. MaxBullets.Value)

2 comments

0

Isn't printing, and should be a comment.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.