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

Why isn't this reload button reloading when a player clicks it?

Asked by 5 years ago

The button gui shows up when i equip the tool and goes away when i unequip the tool but when i click the button it doesnt reload but it says no errors in the output.. so can someone please help me out here, thanks..

local Button = script.Parent

enabled = true





function onClick()

if game.StarterPack:FindFirstChild("Del's Revolver").Ammo.Value ~= game.StarterPack:FindFirstChild("Del's Revolver").MaxAmmo.Value then

reloadsound = game.StarterPack:FindFirstChild("Del's Revolver").Handle:FindFirstChild("Reload")

if reloadsound then

reloadsound:Play()

end

enabled = false

game.StarterPack:FindFirstChild("Del's Revolver").VisibleB.Value = true

game.StarterPack:FindFirstChild("Del's Revolver").StringValue.Value = "Reloading"

repeat game.StarterPack:FindFirstChild("Del's Revolver").StringValue.Value = "Reloading" wait(0.3) game.StarterPack:FindFirstChild("Del's Revolver").Ammo.Value = game.StarterPack:FindFirstChild("Del's Revolver").Ammo.Value + 3 game.StarterPack:FindFirstChild("Del's Revolver").StringValue.Value = "Reloading" until game.StarterPack:FindFirstChild("Del's Revolver").Ammo.Value >= game.StarterPack:FindFirstChild("Del's Revolver").MaxAmmo.Value

game.StarterPack:FindFirstChild("Del's Revolver").Ammo.Value = game.StarterPack:FindFirstChild("Del's Revolver").MaxAmmo.Value

wait(0.2)

game.StarterPack:FindFirstChild("Del's Revolver").VisibleB.Value = false

enabled = true

end

end



Button.MouseButton1Click:connect(onClick)

Answer this question