Hello, I currently have a problem: I created a function used to buy objects,
The problem is that if I buy an item several times, each time the price will be doubled, but I don’t want that.
Thanks to anyone who can help me
Server Script:
repeat wait()
print(game.ReplicatedStorage.BuyDialog)
until game.ReplicatedStorage.BuyR.OnServerEvent:Connect(function(Buy)
if Buy then
money.Value = money.Value - 20
AxeBox.Owner.Value = player.Name
AxeBox.Parent = workspace
NewDialog:Destroy()
hit.Parent.Name = "WoodenAxeBox Owned"
Local Script :
if leaderstats.Money.Value >= 20 then
RemoteEvent:FireServer(Buy)
script.Disabled = true
script.Disabled = false