Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Tycoon Buy Script Doesnt Work? Player Cash Stay The Same!

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

0

here's my discord (mrwan#2646) i'll see if i can help

0

@mroaan Thx but i alr fix it 1 minute after posting :P

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.