Please help with checkpoint leaderboard script?

please help im making an obby but my checkpoints work but my leaderboard doesnt heres the script:

function oa(object)
local player = game.Players:playerFromCharacter(object)
if player ~= nil then
local ls = player.leaderstats
local sl = game.Workspace:FindFirstChild(ls.Stage.Value)
print(“gah”)
object.Torso.CFrame = object.Torso.CFrame + Vector3.new(0,3,0)
wait()
object.Torso.CFrame = sl.CFrame + Vector3.new(0,3,0)
end end

function oe(object)
if object.className == “Player” then
local ack = Instance.new(“IntValue”)
ack.Name = “leaderstats”
local ack2 = Instance.new(“IntValue”)
ack2.Name = “Stage”
ack2.Value = 1
ack2.Parent = ack
ack.Parent = object
end end

game.Players.ChildAdded:connect(oe)
game.Workspace.ChildAdded:connect(oa)

1 Like

Can you place the code as a preformatted text? It’s a bit hard to read as is. It’s the button to the right side of the blockquote option.

function oa(object)
local player = game.Players:playerFromCharacter(object)
if player ~= nil then
	local ls = player.leaderstats
	local sl = game.Workspace:FindFirstChild(ls.Stage.Value)
	print("gah")
	object.Torso.CFrame = object.Torso.CFrame + Vector3.new(0,3,0)
	wait()
	object.Torso.CFrame = sl.CFrame + Vector3.new(0,3,0)
end end

function oe(object)
if object.className == “Player” then
local ack = Instance.new(“IntValue”)
ack.Name = “leaderstats”
local ack2 = Instance.new(“IntValue”)
ack2.Name = “Stage”
ack2.Value = 1
ack2.Parent = ack
ack.Parent = object
end end

game.Players.ChildAdded:connect(oe)
game.Workspace.ChildAdded:connect(oa)

(it doesnt go that far)