Ad
Log in to vote
0

How do i make a save GUI?

Asked by 7 years ago

Hi ive being trying to make a save GUI but it dosent seem to work out ive tried everything from the free models what should i do the value name is "Money" can someone plz help me

1 answer

Log in to vote
0
Answered by 7 years ago

After you save something you'll have to load it too. Make a simple Script and throw it at the Workspace.

Start by making the Gold value and the leaderstats. Every Time the player enters the game the Gold Value will be the one of the Key we will save.

GoldKey = "Gold"

game.Players.PlayerAdded:connect(function(player)
    if player:WaitForDataReady() then
        --  That, will create your leaderboard
        local ls = Instance.new("IntValue")
        ls.Name = "leaderstats"
        ls.Parent = player

        -- And this one will create your Gold stat
        local Golded = Instance.new("IntValue")
        Golded.Name = "Gold"
        Golded.Parent = ls
            Golded.Value = player:LoadNumber(GoldKey)
    end
end)

Now for the save button create a ScreenGui and put it inside the StarterGui folder. Insert the a button into it and a normal script with that code :

GoldKey = "Gold"

function Saved()
    if player:FindFirstChild("leaderstats") then
        player:SaveNumber(GoldKey, player.leaderstats.Gold.Value)    
     end
end

script.Parent.MouseButton1Down:connect(Saved)
0
thank you jls12345678 0 — 7y
Ad

Answer this question