Attempt to compare striong <= number

Idk what is happening here, this code worked before. It jsut now broke? This is on line 5 of this code.

event.OnServerEvent:Connect(function()

	print(cash.Value)
	print(rebirthcost.Value)
	if cash.Value >= rebirthcost.Value then   
		rebirthcost.Value *= 2
		rebirth.Value += 0.1
		math.ceil(rebirth.Value)
		math.ceil(rebirthcost.Value)
		cash.Value = 0
		wood.Value = 0
		print(rebirth.Value)
	else
		print("not enough money")
	end
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Try this:

event.OnServerEvent:Connect(function()

	print(cash.Value)
	print(rebirthcost.Value)
	if tonumber(cash.Value) >= tonumber(rebirthcost.Value) then   
		rebirthcost.Value *= 2
		rebirth.Value += 0.1
		math.ceil(rebirth.Value)
		math.ceil(rebirthcost.Value)
		cash.Value = 0
		wood.Value = 0
		print(rebirth.Value)
	else
		print("not enough money")
	end
end)

But if any of those variables are actually not string/number values then you should remove .Value from it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.