Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone help me with checkpoint system?

Asked by 9 years ago

Hello, I have problem with checkpoint system to my game. I created already checkpoint pad and script, but can't create spawn on this part and checkpoints leaderstats gui.

Here is checkpoint leaderstats, it's not my script, but i know it work, so i want to connect it to my leaderstats:

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)

Here is my leaderstats:

game.Players.PlayerAdded:connect(function(player)
    local leaderstats = Instance.new("IntValue",player)
    leaderstats.Name = "leaderstats"

    local points = Instance.new("NumberValue",leaderstats)
    points.Name = "Points"
    points.Value = 0

    local checkpoints = Instance.new("NumberValue",leaderstats)
    checkpoints.Name = "Checkpoints"
    checkpoints.Value = 1

    local P = game.StarterGui.Points.Frame.Point
    P.Text = " "..points.Value

    local C = game.StarterGui.Checkpoints.Frame.Check
    C.Text = " "..checkpoints.Value

end)

I'm using gui to show points and checkpoints.

Answer this question