I am trying to show the moeny the play has on the gui, when I change it its there but then i have datastore and when i rejoin it doesnt change?
local player = game.Players.LocalPlayer --define player
local Money = player:WaitForChild("leaderstats"):WaitForChild("Data"):WaitForChild("Money") --define cash
Money.Changed:Connect(function() --whenever cash changes
script.Parent.Text = "$ "..Money.Value --set text
end)
Are you changing your money local-sided rather than server-sided? (in Studio there’s a way to toggle between the two modes.) If you’re doing this locally (on the client) it won’t replicate for the server to see, so therefor when DataStores goes to save your data, your money will be viewed as the previous value.
local player = game.Players.LocalPlayer --define player
local Money = player.Leaderstats.Data:WaitForChild("Money") --define cash
Money.Changed:Connect(function() --whenever cash changes
script.Parent.Text = "$ "..Money.Value --set text
end)
local player = game.Players.LocalPlayer --define player
local Money = player:WaitForChild("leaderstats"):WaitForChild("Data"):WaitForChild("Money") --define cash
local function updateText()
script.Parent.Text = "$"..Money.Value
end
Money.Changed:Connect(updateText)
updateText()
local MoneyText = script.Parent.Text
local Players = game:GetService("Players")
local MoneyVal = Players.LocalPlayer.Leaderstats.Data:WaitForChild("Money")
wait(1)
MoneyText = "$ "..MoneyVal.Value --set text when it loads
MoneyVal.Value.Changed:Connect(function() --whenever cash changes
MoneyText = "$ "..MoneyVal.Value --set text
end)