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

How do I change this shop script to make it so my money stays how is after bought?

Asked by 4 years ago
local price = script.Parent.Parent.Price
local tools = game.ReplicatedStorage:WaitForChild("Tools")
local tool = script.Parent.Parent.ItemName
local player = script.Parent.Parent.Parent.Parent.Parent.Parent

script.Parent.MouseButton1Click:connect(function()
    if player.leaderstats:FindFirstChild("Levels").Value >= price.Value then 
        player.leaderstats:FindFirstChild("Levels").Value = player.leaderstats:FindFirstChild("Levels").Value >= price.Value
        game.ReplicatedStorage.ShopBuy:FireServer(tool.Value)
    end
end)

I'm trying to make the money stay as it is when you buy it, anyone have a clue how?

1
You can achieve this through a DataStore—find more on the ROBLOX Developer Wiki. Ziffixture 6913 — 4y
1
Also, to give you a tip, looking at your script it seems as though you check how much money they have on the client. I recommend to not do that, instead check their amount on the server through your remote event. NotedAPI 810 — 4y
0
You can optionally use a RemoteFunction, though. Ziffixture 6913 — 4y

Answer this question