#PLS help script broken (simple script) pls help

1 messages · Page 1 of 1 (latest)

golden fractal
#

so i have a script when the player dies his var which is Ammo when he dies it resets back to 10 if he dies to a player or he resets himself dont matter how he dies

game.Players.PlayerAdded:Connect(function(player)
-- Setup Ammo under the Player
local function setupAmmo()
local ammo = player:FindFirstChild("Ammo")
if not ammo then
ammo = Instance.new("IntValue")
ammo.Name = "Ammo"
ammo.Parent = player
end
ammo.Value = 10
end

-- Initial setup
setupAmmo()

player.CharacterAdded:Connect(function(character)
    -- Wait for Humanoid and then connect Died
    local humanoid = character:WaitForChild("Humanoid")
    

    setupAmmo()

    humanoid.Died:Connect(function()
        setupAmmo()
    end)
end)

end)

#

also he spawns with 10

tidal sphinx
cinder willow
#

Sooo whats the error?

golden fractal
golden fractal
tidal sphinx
#

So player.CharacterAdded for example

jolly haven
jolly haven
tidal sphinx
jolly haven
#

Oh wait nvm scripter 1

tidal sphinx
jolly haven
#

plr.Character

tidal sphinx
#

💀

jolly haven
#

Nah

#

Still depends on when he wants the ammo to reset

golden fractal
#

wait so what do i do

golden fractal
jolly haven
golden fractal
#

no theres no error, it just doesent work at all

#

like nothing happens

#

and theres no error