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

How do I save guis with DataStore?

Asked by 5 years ago

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.

01-- the script that is going to fire the remote
02 
03tool = game.Lighting.Tools.Dominus1
04player = game.Players.LocalPlayer
05money = player.leaderstats.Clicks
06price = script.Parent.Cost.Value
07buybutton = game.StarterGui.ShopGui.ShopFrame.Item1
08 
09 
10 
11function buy()
12     if money.Value >= price then
13        money.Value = money.Value - price
14        workspace.EventsScript.BuyItem1:FireServer()
15        wait()
View all 30 lines...

1 answer

Log in to vote
2
Answered by
SmartNode 383 Moderation Voter
5 years ago

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.

Ad

Answer this question