I made a block that has the script as a child of that block and it does delete the block but my value for spare ammo does not change?
local giveAmmo = 14
script.Parent.Touched:connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
hit.Parent.Handgun.SpareAmmo.Value = hit.Parent.Handgun.SpareAmmo.Value + giveAmmo
script.Parent:Destroy()
end
end)
P.S. The "SpareAmmo" is an "int value" that I input into the gun and the gun works perfectly well.
ExtraAmmo = script.Parent.SpareAmmo.Value
local function Reload()
if not Reloading then
Reloading = true
if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
if RecoilTrack then
RecoilTrack:Stop()
end
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = true
end
end
if ReloadTrack then
ReloadTrack:Play()
end
script.Parent.Handle.Reload:Play()
wait(ReloadTime)
local ammoToUse = math.min(ClipSize - AmmoInClip, ExtraAmmo)
AmmoInClip = AmmoInClip + ammoToUse
ExtraAmmo = ExtraAmmo - ammoToUse
UpdateAmmo(AmmoInClip)
if ReloadTrack then
ReloadTrack:Stop()
end
end
Reloading = false
end
end
And this is the reloading part of the script if you guys need it.

1 comment
Is it not changing at all or is the gun not reconizing that it changed?