So… this is my leaderstats/datasave script… works 100%
local dss = game:GetService(“DataStoreService”)
local DataStoreToKeep = dss:GetDataStore(“Chipotle”)
game.Players.PlayerAdded:Connect(function(player)
local is = Instance.new(“Folder”,player)
is.Name = “leaderstats”local money = Instance.new(“IntValue”,is)
money.Name = “Money”
money.Value = 0local cc = Instance.new(“IntValue”)
cc.Parent = player
cc.Name = “CashCollected”local robbing = Instance.new(“BoolValue”,player)
robbing.Name = “Robbing”
robbing.Value = falseplayer.CharacterAdded:Connect(function(char)
player.Robbing.Value = false
player.CashCollected.Value = 0
end)local data
local success, errormessage = pcall(function()
data = DataStoreToKeep:GetAsync(player.UserId… “-money”)
end)
if success then
money.Value = data
else
warn(errormessage)
end
end)game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
DataStoreToKeep:SetAsync(player.UserId…"-money",player.leaderstats.Money.Value)
end)
if success then
else
warn(errormessage)
end
end)game:BindToClose(function()
for i, player in pairs(game.Players:GetPlayers()) do
DataStoreToKeep:SetAsync(player.UserId…"~money", player.leaderstats.Money.Value)
end
end)
But I have a Gui
I want it to show the money… so I scripted this inside of the text label… its a local scriptlocal text_label = script.Parent
local plr = game.Players.LocalPlayerplr:WaitForChild(“leaderstats”).Height.Changed:Connect(function(val)
text_label.Text = "Height: "…val
end)text_label.Text = "Height: "…plr:WaitForChild(“leaderstats”).Height.Value
but when I test it doesnt work… Can someone tell me what I did wrong or rewrite the local script or me please…