So i try to make a tycoon game, i succesfully make a button to buy.
It did spawn the Building, but the player Cash didn't reduced by the price!
Script:
local Price = script.Parent.Price.Value
local Item = script.Parent.Building.Value
script.Parent.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
local PlayerCash = Player:WaitForChild("leaderstats").Cash.Value
local Building = game.ServerStorage.Building[Item]
if PlayerCash >= Price then
PlayerCash = PlayerCash - Price
Building.Parent = workspace.Tycoon
script.Parent:Destroy()
end
end)
local Gui = script.Parent.Gui
Gui.Item.Text = Item
Gui.Price.Text = "$"..Price
-I Already Add Price and Item Value on The Button
-No OutPut
-The Building Spawned, But PlayerCash stay same
Thank's for Reading!

2 comments
here's my discord (mrwan#2646) i'll see if i can help
@mroaan Thx but i alr fix it 1 minute after posting :P