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

Data store not saving the correct value help?

Asked by
NotSoNorm 777 Moderation Voter
9 years ago

So I'm trying to make it save the text of the gui and it won't save, It just keeps loading "TextBounds"

Filtering enabled is on and it's in Workspace

local SetBackData = {}

MoneyStore = game:GetService("DataStoreService"):GetDataStore("DataStore")

function PlayerEntered(player)
    repeat wait() until player.Character
    if MoneyStore:GetAsync("Money_"..player.Name) ~= nil then
        game.Players[player.Name].PlayerGui.MoneyDisplay.Money.TextLabel.Text = MoneyStore:GetAsync("Money_"..player.Name)
    else
        game.Players[player.Name].PlayerGui.MoneyDisplay.Money.TextLabel.Text = "1500"
        print("New money value")
    end


--timleft = 0
    game.Players[player.Name].PlayerGui.MoneyDisplay.Money.TextLabel.Changed:connect(function(Text)
        --if timleft <= 1 then
        wait(1)
        MoneyStore:SetAsync("Money_"..player.Name, Text)
        print("Saved")
            --timleft = 20
            --for i = 20, 1, -1 do
                --timleft = i
            --end
        --end
    end)
end

game.Players.PlayerAdded:connect(PlayerEntered)

1 answer

Log in to vote
1
Answered by
4Bros 550 Moderation Voter
9 years ago

Did you define the variable Text on line 19?

Ad

Answer this question