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

Is it possible to upload data to playergui?

Asked by 5 years ago

I'm using an basic Data Saving script I'm not getting any errors. But it's not saving the cash is it because where the Money value is being stored? Script:

local DataStoreService = game:GetService("DataStoreService")

local MoneyData = DataStoreService:GetDataStore("MoneyData")

local Players = game:GetService("Players")

game.Players.PlayerAdded:Connect(function(player)

local Money = player.PlayerGui:WaitForChild("MoneyValue").PlayerStat.MoneyValue.Value

local Data

local success, errormessage = pcall(function()

Data = MoneyData:GetAsync(player.UserId.."-Money")

end)

if success then

Money = Data

else

print("DataNotStored")

warn(errormessage)

end

end)

game.Players.PlayerRemoving:Connect(function(player)

local success, errormessage = pcall(function()

MoneyData:SetAsync(player.UserId.."-Money",player.PlayerGui.MoneyValue.PlayerStat.MoneyValue.Value)

end)

if success then

print("DataStored")

else

print("DataNotStored")

warn(errormessage)

end

end)

0
use bindtoclose and make sure the data is being given through the server and not the client greatneil80 2647 — 5y
0
Also, please use the code block feature. It's there for a reason. BlueGrovyle 278 — 5y
0
This didn't work and Idk there was a code block feature DogCooper 2 — 5y
0
oof I really don't know what the issue is as it says that the data saves successfully DogCooper 2 — 5y
0
I fixed this DogCooper 2 — 5y

Answer this question