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

how come im not teleporting with a save and load script?

Asked by 6 years ago

***Save Script


function SaveScore(plyr, score) plyr:SaveNumber("stage", score) end

function onClicked()

player = script.Parent.Parent.Parent.Parent.Parent
    player:WaitForDataReady()

if player.DataReady == true then SaveScore(player, player.leaderstats:findFirstChild(script.Parent.Parent.Parent.Configuration.Type.Value).Value) m = Instance.new("Message",player.PlayerGui) m.Text = script.Parent.Parent.Parent.Configuration.Type.Value.. " saved!" game:service("Debris"):AddItem(m, 3) else m = Instance.new("Message",player.PlayerGui) m.Text = "Wait until DataReady!" game:service("Debris"):AddItem(m, 3)

end end

script.Parent.MouseButton1Click:connect(onClicked)

function loadScore(plyr, clickCounter)

local score = plyr:LoadNumber("stage") 

if not score == 0 then
    clickCounter.Value = score
else
    print("Nothing to load../..score was 0")
end

end

Load script

function onClicked()

player = script.Parent.Parent.Parent.Parent.Parent
    player:WaitForDataReady()

if player.DataReady == true then loadScore(player, player.leaderstats:findFirstChild(script.Parent.Parent.Parent.Configuration.Type.Value)) player.leaderstats:findFirstChild(script.Parent.Parent.Parent.Configuration.Type.Value).Value = player:LoadNumber("stage") m = Instance.new("Message",player.PlayerGui) m.Text = script.Parent.Parent.Parent.Configuration.Type.Value.. " loaded!" script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0 game:service("Debris"):AddItem(m, 3) else m = Instance.new("Message",player.PlayerGui) m.Text = "Wait until DataReady!" game:service("Debris"):AddItem(m, 3) end end

script.Parent.MouseButton1Click:connect(onClicked)

How come I'm not teleporting to the stage that I saved???

0
i need help someone TheEpicLOLer -4 — 6y

Answer this question