I am trying to make a cookie clicker game on my surfacegui. When you have 100 cookies or more you can buy a Worker, who makes the cookies with a loop, but the loop i put Mouse Down function does not work. The loop stops when 2 cookies are added but it cant add more than 2 cookies.. Help?
local cookie = script.Parent
local noob = script.Parent.Parent.NoobWorker.Script
local cooki21e = script.Parent.Parent.Parent.Parent.RealAmount.IntValue
local cooke1 = script.Parent.Parent.Parent.Parent.RealAmount
local oneNOOB = script.Parent.Parent.Parent.Parent.Noob1
script.Parent.MouseButton1Down:Connect(function()
if cooki21e.Value < 100 then
print("Below 100")
elseif cooki21e.Value > 100 then
cooki21e.Value = cooki21e.Value - 100
cooke1.Text = cooki21e.Value
oneNOOB.Visible = true
print("Above 100, taking 100 cookies")
while true do
wait(1)
cooke1.Text = cooki21e.Value + 1
end
end
end)

2 comments
Make sure all your values are correct before anything.
I just watched some of the question and I saw this question are upvoted pretty fast so I rushed to here to upvote XD