im trying to make a game like cookie clicker, and i have the cookie that you click. but the first upgrade which will give you cookies per second, makes my game crash. its supposed to cost me 10 clicks. and then every second, it would give me one click.
script.Parent.Touched:connect(function()
for _,Player in pairs(game.Players:GetPlayers()) do
if Player:FindFirstChild("leaderstats") then
Player.leaderstats.Clicks.Value = Player.leaderstats.Clicks.Value - 10
end
while true do
if Player.leaderstats.Clicks.Value > 10
then Player.leaderstats.Clicks.Value = Player.leaderstats.Clicks.Value + 1
wait(1)
else print("not gonna happen")
end
end
end
end)
whenever i touch the part, it crashes studio. any fixes?
