#Need help with Stage leaderboard

1 messages · Page 1 of 1 (latest)

cedar haven
#

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")

#

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

local isPrimary = Instance.new("BoolValue")
isPrimary.Name = "IsPrimary"
isPrimary.Value = true
isPrimary.Parent = Stage

end

Players.PlayerAdded:Connect(leaderboardSetup)

rose nymph
#

What's the issue