I'm making a simulator that has a shop gui. I can save the leaderboard and the backpack but not the guis. For example, if the player buys an item the buy button would be destroyed. But when the player rejoins, the buy button would still there. Which means that you can buy the item twice. Sorry if you don't understand.
-- the script that is going to fire the remote tool = game.Lighting.Tools.Dominus1 player = game.Players.LocalPlayer money = player.leaderstats.Clicks price = script.Parent.Cost.Value buybutton = game.StarterGui.ShopGui.ShopFrame.Item1 function buy() if money.Value >= price then money.Value = money.Value - price workspace.EventsScript.BuyItem1:FireServer() wait() buybutton.Visible = false end end script.Parent.MouseButton1Down:Connect(buy) -- the script that is going to be the event (the script in workspace) script.BuyItem1.OnServerEvent:Connect(function(plr) wait() local a = tool:clone() a.Parent = plr.Backpack local b = tool:clone() b.Parent = plr.StarterGear end)
Instead of saving the GUI itself, store a boolean or check if the player still the item. The buy button should always be there but can be turned invisible if you run some checks.
Let’s say I have a player and he bought a sword, he can no longer buy it again. I can simply turn the Buy button’s Invisibility off until he no longer has the sword.
However if you’re trying to implement this when he rejoins then I’d add some type of Boolean in the Datastore for better practice.