Hello, i am making a clicker game that has 6 buildings and i implanted a data store system for saving cash, but i want it to save Buildings... and one specific building i want to test if it updates is Human. I want to test if Human can be saved and i put something in the script that makes it add value when it is clicked. But it is not working, so how do i fix this?

plr = script.Parent.Parent.Parent.Parent.Parent
Cost = script.Parent.BuildingCost.Cost
CPS = script.Parent.Parent.Parent.CPS
HumanValue = plr.leaderstats.Human.Value

script.Parent.MouseButton1Click:connect(function()
	if plr.leaderstats.Cash.Value >= Cost.Value then
		HumanValue = HumanValue + 1
		if true then
		plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value - Cost.Value
		script.Parent.BuildingCost.Cost.Value = script.Parent.BuildingCost.Cost.Value + 6
		script.Parent.BuildingCost.Text = "Requires $"..Cost.Value.. ""
		
		CPS.Value = CPS.Value + 1
		
		end
	end
end)

2 comments

0

Is this a localscript or a normal script

0

In the future, please avoid making frequent reposts of the same question. This is considered SPAM and might be moderated. Don't be surprised if you don't get an answer immediately. Give it a few days, and if it still goes unanswered, you can ask the Discord server.