local CashOnClick = 1 clickdetector.MouseClick:Connect(function() clickdetector.Parent:Destroy() for i,v in pairs(game.Players:GetPlayers()) do if v:FindFirstChild("leaderstats") then v.leaderstats['Apples Clicked'].Value = v.leaderstats['Apples Clicked'].Value + 1 v.leaderstats['Cash'].Value = v.leaderstats['Cash'].Value + 1 if v.leaderstats['Apples Clicked'].Value == 10 then v.leaderstats['Cash'].Value = CashOnClick.Value + 1 end end end end)
I have not included the whole script but im attempting to make it so every time "Apples Clicked"'s value goes up by 10, the CashOnClick Value goes up by 1, therefor increasing the amount of cash gained per click. Yet It gives me the error "attempt to index global 'CashOnClick' (a number value)"

6 comments
Don't forget to accept my answer if it helps out. It gives us both the reps we deserve.
What exactly are you trying to do every 10 clicks then?
I have edited my answer. Please check the update.
Made another edit. But please do try to solve it yourself next time. Try it now. You can change the + 1 in line 10 to whatever number you want it to increase by
How does it not work.
Made a LAST edit.