I am working on a car spawner script that works well except for 1 thing..... The money is given back after the purchase any clue? here is the local script:
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.Purchased.Value == true then
game.ReplicatedStorage.SpawnCar:FireServer(script.Parent.Parent.Name)
else
local PriceOfItem = game.ReplicatedStorage:WaitForChild("CheckPrice"):InvokeServer(script.Parent.Parent.Name)
if game.Players.LocalPlayer.leaderstats.Cash.Value >= PriceOfItem and script.Parent.Parent.Purchased.Value == false then
game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value - PriceOfItem
script.Parent.Parent.Purchased.Value = true
end
end
end)

1 comment
You are changing the money value in the client which will not be reflected to the server. I recommend you using an remote event to change the money for the player.