Coin Management

Replenishment Script (Workspace Folder)

local ServerStorage = game:GetService('ServerStorage')

while wait() do
    local coinFolder = game.Workspace.CoinFolder:GetChildren()
    if #coinFolder < 50 then
        local newCoin = ServerStorage.CoinFolder['Coin']:Clone()
        newCoin.Name = 'Coin'
        newCoin.Parent = game.Workspace.CoinFolder
        newCoin.Position = Vector3.new(math.random(-250,250),5, math.random(-250,250)) 
    end
end

Leaderstats (ServerScriptService)

local function onPlayerJoin(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player
 

    local coins = Instance.new("IntValue")
    coins.Name = "Coins"
    coins.Value = 0
    coins.Parent = leaderstats
end
 

game.Players.PlayerAdded:Connect(onPlayerJoin)

Coin Script (Under Part)

local coin = script.Parent

local function collect(otherPart)
    local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
    if humanoid then
        local player = game.Players:FindFirstChild(otherPart.Parent.Name)
        player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1
        coin:Destroy()
    end
end

coin.Touched:Connect(collect)