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

Why wont this save script work? [Still need help]

Asked by
Dr_Doge 100
8 years ago
function enter(plr)
    repeat wait() until plr.Character.Head~= nil
wait(0)
    local stats = plr
    local w = Instance.new("IntValue")
    w.Name = "Fly"
    w.Value = 2
    w.Parent = stats
    local w = Instance.new("IntValue")
    w.Name = "Damage"
    w.Value = 4.6
    w.Parent = stats
    local w = Instance.new("IntValue")
    w.Name = "Music"
    w.Value = 138103237
    w.Parent = stats
    wait(0)
    plr.Fly.Value = plr:LoadNumber("Fly")
    wait(0)
    plr.Fly.Value = plr:LoadNumber("Damage")
    wait(0)
    plr.Fly.Value = plr:LoadNumber("Music")

end
function leave(plr)
    plr:SaveNumber("Fly", plr.leaderstats.Gold.Value)
    plr:SaveNumber("Damage", plr.leaderstats.Gold.Value)
    plr:SaveNumber("Music", plr.leaderstats.Gold.Value)
end
game.Players.PlayerAdded:connect(enter)
game.Players.PlayerRemoving:connect(leave)
0
Have you considered using DataStores? I would also make a .CharacterAdded function for the player instead of the repeat wait() until player.Character.Head~=nil. BobserLuck 367 — 8y
0
..? what does this mean LUCATIVIOMAD 31 — 4y

1 answer

Log in to vote
0
Answered by 8 years ago

I'm 100% not sure about this First: Are you kidding me? or that was just a test?

plr:SaveNumber("Fly", plr.leaderstats.Gold.Value)
plr:SaveNumber("Damage", plr.leaderstats.Gold.Value)
plr:SaveNumber("Music", plr.leaderstats.Gold.Value)

^I don't think plr.leaderstats.Gold.Value exists...

Try this: (onAdded)

    local stats = plr
    local w1 = Instance.new("IntValue")
    w1.Name = "Fly"
    w1.Value = 2
    w1.Parent = stats
    local w2 = Instance.new("IntValue")
    w2.Name = "Damage"
    w2.Value = 4.6
    w2.Parent = stats
    local w3 = Instance.new("IntValue")
    w3.Name = "Music"
    w3.Value = 138103237
    w3.Parent = stats
    wait(0)
    w1.Value = plr:LoadNumber("Fly")
    wait(0)
    w2.Value = plr:LoadNumber("Damage")
    wait(0)
    w3.Fly.Value = plr:LoadNumber("Music")

Please don't tell me you coded it while sleeping. You have made so many mistakes, xD I thought i kinda remade the code, Enjoy!

Ad

Answer this question