#How to stop leaderstats from going to negatives?

2 messages · Page 1 of 1 (latest)

dusty crater
#

okay this is really simple but here you go ig

local players = game:GetService("Players")

local function PlayerJoined(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Parent = game.Workspace
    leaderstats.Name = "leaderstats"

    local Timer = Instance.new("IntValue")
    Timer.Name = "Time"
    Timer.Value = 100
    Timer.Parent = leaderstats

    leaderstats.Parent = player
    while wait(1) do
        if Timer.Value ~= 0 then
        Timer.Value = Timer.Value - 1
        end
    end    
end
players.PlayerAdded:Connect(PlayerJoined)