Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

01local Buy = script.Parent
02local Count = script.Parent.ClickerCount
03local TotalCookies = script.Parent.Parent.TotalCookies
04local Cost = script.Parent.ClickerCost
05 
06 
07Buy.MouseButton1Click:Connect(function()
08 
09if TotalCookies.Text >= Cost.Text then
10 
11workspace.Purchased.Playing = true
12TotalCookies.Text = TotalCookies.Text - Cost.Text
13Count.Text = Count.Text + 1
14Cost.Text = Cost.Text + Cost.Text - 20
15 
View all 22 lines...

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.

0
I don't have IntValues, do I need to use them or? Also thanks for replying ElongatedMongoose 138 — 4y
0
U should use NumberValues ArCeMo6 -1 — 4y
0
Thanks I will try that! ElongatedMongoose 138 — 4y

Answer this question