You’ve probably seen debounce scripts and what it does, and it stops code from running in general. Would you like to know how to make it locally (Code will run multiple times but for only one player)?

  1. The Set Up

We need to use the PlayerAdded event of the Players service to insert a BoolValue into the Player.

local Players = game:GetService”Players”
Players.PlayerAdded:Connect(function(plr)
    local debounce = Instance.new(“BoolValue”,plr) –– Making the Boolean value
    debounce.Name = “Debounce”
    debounce.Value = false
    local ls = Instance.new(“Configuration”,plr)
    ls.Name = “leaderstats”
    local cash = Instance.new(“IntValue”,ls)
    cash.Name = “Cash”
    cash.Value = 0
end)

A Script with debounce that gives 10,000 in game cash with leaderstats.

script.Parent.Touched:Connect(function(part)
    local players = game:GetService(“Players”)
    local pl = players:GetPlayerFromCharacter(part.Parent)
    
    if pl and not pl.Debounce.Value then
        pl.Debounce.Value = true
        pl.leaderstats.Cash.Value = pl.leaderstats.Cash.Value + 10000

        
    end
end)

script.Parent.TouchEnded:Connect(function(part)
    local plr = game:GetService(“Players”):FindFirstChild(part.Parent.Name)
    
    if plr then
        plr.Debounce.Value = false
    end
end)