script.Parent.MouseButton1Down:Connect(function(plr)
local cookies = plr:WaitForChild("Stats"):FindFirstChild("Cookies")
cookies.Value = cookies.Value + 1
end)
The error:
Players.topcst.PlayerGui.Main.Frame.Cookie.Handler:2: attempt to index number with ‘WaitForChild’
It is run by a normal script as i can avoid remote events and the issues they can cause. I know this is possible because i’ve done it before (inb4 someone says use remote events)
There is no player argument in MouseButton1Down. You can get the player by doing game.Players.LocalPlayer. Also, what is passed is the x and y, so they’re numbers, hence why you’re getting the error.