Soooo, I have making a Zombie game, I have done making a ammo box, its working back in the time, but now its not working anymore, like log printing that the Mag is full, but in reality its doesnt change anything.Everything is serverside script.
Heres the code:
local Prompt = script.Parent
local Hitbox = Prompt.Parent
local Use = Hitbox.Use
local debounce = false
Hitbox.BillboardGui.Use.Text = "Use: ".. tostring(Use.Value)
Prompt.Triggered:Connect(function(plr)
for i,v in pairs(plr.Character:GetChildren()) do
if v:IsA("Tool") then
if v:FindFirstChild("IsAGun") then
if Use.Value <= 0 then
else
v.Mag.Value = v.MaxMag.Value
v.Ammo.Value = v.MaxAmmo.Value
v.Handle.SFX.Tick:Play()
print(tostring(v.Mag.Value))
Use.Value = Use.Value - 1
v.Mag.Value = v.MaxMag.Value
v.Ammo.Value = v.MaxAmmo.Value
if Use.Value == 0 then
Hitbox.BillboardGui.Use.Normal.Enabled = false
Hitbox.BillboardGui.Use.NoAmmo.Enabled = true
Prompt.Enabled = false
else
local a = 10
--debounce = true
Prompt.Enabled = false
Hitbox.BillboardGui.Use.Normal.Enabled = false
Hitbox.BillboardGui.Use.NoAmmo.Enabled = true
for i = 1,10 do
a = a - 1
Hitbox.BillboardGui.Use.Text = tostring(a)
wait(1)
end
--debounce = false
Prompt.Enabled = true
Hitbox.BillboardGui.Use.Normal.Enabled = true
Hitbox.BillboardGui.Use.NoAmmo.Enabled = false
end
Hitbox.BillboardGui.Use.Text = "Use: ".. tostring(Use.Value)
end
end
end
end
end)
Heres what the print(tostring(v.Mag.Value)) print:
heres what it actually:
(the previous Mag is 5)
i’ve tried every way but its doesnt work, If you guys got any solution, Thanks you! :3
-Hause’s Zombies Dev-