make a game that keeps score with the other players and has a leaderboard copy and paste right to your own game in studio

Here’s a collection of Roblox Studio scripts for games that involve keeping score. These scripts track player performance and can be used in competitive or cooperative game modes.

1. Basic Scoring System

This script adds points to a player’s score when they touch a specific part.

local part = script.Parent

part.Touched:Connect(function(hit)

    local player = game.Players:GetPlayerFromCharacter(hit.Parent)

    if player then

        local leaderstats = player:FindFirstChild(“leaderstats”)

        if leaderstats and leaderstats:FindFirstChild(“Score”) then

            leaderstats.Score.Value = leaderstats.Score.Value + 10 — Add 10 points

        end

    end

end)

How to Use:

1. Add a leaderstats script (see script 2 below).

2. Insert a Part and attach the script above to it.

3. Players earn points by touching the part.

2. Leaderstats Script

This script creates a leaderboard for players and initializes a “Score” value.

game.Players.PlayerAdded:Connect(function(player)

    local leaderstats = Instance.new(“Folder”)

    leaderstats.Name = “leaderstats”

    leaderstats.Parent = player

    local score = Instance.new(“IntValue”)

    score.Name = “Score”

    score.Value = 0

    score.Parent = leaderstats

end)

How to Use:

• Place this script in ServerScriptService.

• A “Score” value will automatically appear on the leaderboard for each player.

3. Score on Kill Script

This script adds points to a player’s score when they eliminate another player.

game.Players.PlayerAdded:Connect(function(player)

    player.CharacterAdded:Connect(function(character)

        local humanoid = character:WaitForChild(“Humanoid”)

        humanoid.Died:Connect(function()

            local killer = humanoid:FindFirstChild(“creator”)

            if killer and killer.Value then

                local killerPlayer = game.Players:GetPlayerFromCharacter(killer.Value)

                if killerPlayer then

                    local leaderstats = killerPlayer:FindFirstChild(“leaderstats”)

                    if leaderstats and leaderstats:FindFirstChild(“Score”) then

                        leaderstats.Score.Value = leaderstats.Score.Value + 25 — Add 25 points for a kill

                    end

                end

            end

        end)

    end)

end)

How to Use:

1. Ensure weapons assign a “creator” tag to the killer (most do this by default).

2. Add this script to ServerScriptService.

4. Subtract Points on Death

This script subtracts points from a player when they die.

game.Players.PlayerAdded:Connect(function(player)

    player.CharacterAdded:Connect(function(character)

        local humanoid = character:WaitForChild(“Humanoid”)

        humanoid.Died:Connect(function()

            local leaderstats = player:FindFirstChild(“leaderstats”)

            if leaderstats and leaderstats:FindFirstChild(“Score”) then

                leaderstats.Score.Value = math.max(0, leaderstats.Score.Value – 10) — Subtract 10 points, no negative scores

            end

        end)

    end)

end)

How to Use:

• Add this script to ServerScriptService.

5. Timer-Based Scoring

This script awards points to players over time while they remain in the game.

local pointsPerSecond = 5

while true do

    wait(1)

    for _, player in pairs(game.Players:GetPlayers()) do

        local leaderstats = player:FindFirstChild(“leaderstats”)

        if leaderstats and leaderstats:FindFirstChild(“Score”) then

            leaderstats.Score.Value = leaderstats.Score.Value + pointsPerSecond

        end

    end

end

How to Use:

• Add this script to ServerScriptService.

• Players earn points automatically every second.

6. Score Multipliers

This script doubles a player’s score when they touch a special part.

local part = script.Parent

part.Touched:Connect(function(hit)

    local player = game.Players:GetPlayerFromCharacter(hit.Parent)

    if player then

        local leaderstats = player:FindFirstChild(“leaderstats”)

        if leaderstats and leaderstats:FindFirstChild(“Score”) then

            leaderstats.Score.Value = leaderstats.Score.Value * 2 — Double the score

        end

    end

end)

How to Use:

• Insert a Part and attach the script above.

• When players touch the part, their score is multiplied.

7. Score Reset Script

This script resets all player scores at a specific time interval.

local resetInterval = 300 — Reset every 300 seconds (5 minutes)

while true do

    wait(resetInterval)

    for _, player in pairs(game.Players:GetPlayers()) do

        local leaderstats = player:FindFirstChild(“leaderstats”)

        if leaderstats and leaderstats:FindFirstChild(“Score”) then

            leaderstats.Score.Value = 0

        end

    end

end

How to Use:

• Add this script to ServerScriptService.

8. Win Condition Script

This script declares a winner when a player reaches a specific score.

local winningScore = 100

game.Players.PlayerAdded:Connect(function(player)

    player.leaderstats.Score.Changed:Connect(function(newScore)

        if newScore >= winningScore then

By:

Posted in:


Leave a comment

Design a site like this with WordPress.com
Get started