local Players = game:GetService("Players")
local function leaderboardSetup(player)
end
-- Connect the "leaderboardSetup()" function to the "PlayerAdded" event
Players.PlayerAdded:Connect(leaderboardSetup)
local Players = game:GetService("Players")
local function leaderboardSetup(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
end
-- Connect the "leaderboardSetup()" function to the "PlayerAdded" event
Players.PlayerAdded:Connect(leaderboardSetup)
local Players = game:GetService("Players")
local function leaderboardSetup(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Checkpoint = Instance.new("IntValue")
Checkpoint.Name = "Stage"
Checkpoint.Value = 0
Checkpoint.Parent = leaderstats
end
-- Connect the "leaderboardSetup()" function to the "PlayerAdded" event
Players.PlayerAdded:Connect(leaderboardSetup)
local Players = game:GetService("Players")
local Checkpoints = workspace:WaitForChild("Checkpoints") = script.Parent
local function onPartTouch(otherPart)
local partParent = otherPart.Parent
local player = Players:GetPlayerFromCharacter(partParent)
local leaderstats = player and player:FindFirstChild("leaderstats")
local CheckpointStat = leaderstats and leaderstats:FindFirstChild("Stage") = leaderstats and leaderstats:FindFirstChild("Gold")
if CheckpointStat then
-- Destroy the pickup
CheckpointStat:Destroy()
-- Update the player's leaderboard stat
CheckpointStat.Value += 10
end
end
Checkpoints.Touched:Connect(onPartTouch)
local Players = game:GetService("Players")