My script isn't counting properly?
Asked by
4 years ago Edited 4 years ago
So I made this script for a cookie clicker type game, but the problem is that the cookies are going into the negative and the cookies are not subtracting properly.
Sometimes the total cookies are more or equal to the cost, sometimes it allows to purchase at way lower
01 | local Buy = script.Parent |
02 | local Count = script.Parent.ClickerCount |
03 | local TotalCookies = script.Parent.Parent.TotalCookies |
04 | local Cost = script.Parent.ClickerCost |
07 | Buy.MouseButton 1 Click:Connect( function () |
09 | if TotalCookies.Text > = Cost.Text then |
11 | workspace.Purchased.Playing = true |
12 | TotalCookies.Text = TotalCookies.Text - Cost.Text |
13 | Count.Text = Count.Text + 1 |
14 | Cost.Text = Cost.Text + Cost.Text - 20 |
18 | workspace.Error.Playing = true |
It's a super basic project i'm working on for fun, but I really need to get past this part. Help is greatly appreciated.