Can I save the gui in the datastore?

have a purchase of locations and I need to save them, can I save them in Datastore?

How I want:
https://cdn.discordapp.com/attachments/941709005695373323/950420166406197248/2022-03-07_18-42-30.mp4

i think you have to make a boolvalue to check if you bought it or not (yea need datastore too)

I tried but it didn’t save! Any other ideas?

that all i can think about,you have to use datastore

DataStore can not be accessed from the Client. Are you saving it on the Server?

No, I’ve tried everywhere. Does not work

pasa el script para que podamos ver el error

I have BoolValue always appointed but true and does not saving, Can it be fixed?

script:

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("playerData")

game.Players.PlayerAdded:Connect(function(Player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = Player
	
	local Levels = Instance.new("Folder")
	Levels.Name = "Levels"
	Levels.Parent = Player
	
	local Coins = Instance.new("IntValue")
	Coins.Value = DataStore:SetAsync(Player.UserId) or 0
	Coins.Name = "Coins"
    Coins.Parent = leaderstats
	
	local Level1 = Instance.new("IntValue")
	Level1.Value = DataStore:SetAsync(Player.UserId) or 0
	Level1.Name = "Level1"
	Level1.Parent = Levels

end)

game.Players.PlayerRemoving:Connect(function(Player)
	DataStore:GetAsync(Player.UserId, Player.leaderstats.Coins.Value)
	
	DataStore:GetAsync(Player.UserId, Player.Levels.Level1.Value)
end)

Can its possible to fix? (It’s just text)

1 Like

it possible to fixyeaaaa

You have to save the purchase, for example you can save a table with the value of:

{[“stage1”] = false, [“stage2”] = true}

Then update it when the player buys the button, save it when the player leaves, and change the Ui to “teleport” using the data from the table when the player joins.