I made a dialog shop for my game "Universe Explorers" but when the player buys something from the shop, he still gets the item, but his money doesn't get taken away.
function moneyCheck(player,value,object,cashier) local money = player.leaderstats.Money.Value if money >= value then local findObject = game.ServerScriptService:FindFirstChild(object) if findObject then local object = findObject:Clone() object.Parent = player.Backpack wait(0.1) money = money - value game:GetService("Chat"):Chat(cashier.Head,"Here you go!","Red") print("Player has bought "..object.Name) end elseif money <= value then wait(0.1) game:GetService("Chat"):Chat(cashier.Head,"Sorry, but you don't have enough money.","Red") end end script.Parent.DialogChoiceSelected:connect(function(player,choice) if choice.UserDialog == "Ray Gun - $150" then moneyCheck(player,30,"RayGun1",script.Parent.Parent.Parent) end end)