Collection Scripts

Collection Scripts

Leaderboard

Place this script under 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)

Touch for Point

Place this script under the Part

local part = script.Parent

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

part.Touched:Connect(collect)

Touch for Random Points

Place this script under the Part

local part = script.Parent

local function collect(otherPart)
    local player = game.Players:FindFirstChild(otherPart.Parent.Name)
    if player then
        player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + math.random(1,100)
        part:Destroy() 
    end
 
end

part.Touched:Connect(collect)

Touch for Point Then Teleport

Place this script under the Part

local part = script.Parent
local addPoint = true


local function collect(otherPart)
    local player = game.Players:FindFirstChild(otherPart.Parent.Name)
    if player then
        if addPoint then
            addPoint = false
            player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1 
        end
        part.Position = Vector3.new(math.random(-100,100),part.Position.Y, math.random(-100,100))
        part.BrickColor = BrickColor.new('Really red')
        wait(1)
        addPoint = true
  
    end
end

part.Touched:Connect(collect)

Sell Pad and Destroy Part

Place script under sell pad part

"Coin" needs to be a Tool with a part inside called Handle (make sure there is no weld)

local part = script.Parent

local function collect(otherPart)
    local player = game.Players:FindFirstChild(otherPart.Parent.Name)
    if player then
        local playerModel = game.Workspace:FindFirstChild(player.Name)
        local tool = playerModel:FindFirstChild('Tool')
        if tool then
            tool:Destroy()
            player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1 
        end
    end
end

part.Touched:Connect(collect)

Sell Pad and Teleport Part

Place script under sell pad part

"Coin" needs to be a Tool with a part inside called Handle (make sure there is no weld)

(-50,50) bounds can be adjusted to change teleport range. Bigger bounds means larger possible teleport area.

local part = script.Parent


local function collect(otherPart)
    local player = game.Players:FindFirstChild(otherPart.Parent.Name)
    if player then
        local playerModel = game.Workspace:FindFirstChild(player.Name)
        local tool = playerModel:FindFirstChild('Tool')
        if tool then
            tool.Parent = game.Workspace
            tool.Handle.Position = Vector3.new(math.random(-50,50),0.5,math.random(-50,50))
            player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1  
        end
    end
end

part.Touched:Connect(collect)