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)
