Script isn't working

Can someone help me? I don’t see any mistakes but it doesn’t seem to be working!

local clicked = false
script.Parent.Money.MouseButton1Click:Connect(function(begin)
	local Cash = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Cash")
	clicked = true
	if clicked then
		Cash.Value = Cash.Value + math.Random(1,10000)
		clicked = false
		wait(86400)
		script.Parent.Money.MouseButton1Click:Connect(function()
			script.Parent.Visible = false
		end)
	end
end)

Is it a local script or a script?

    local clicked = false
    script.Parent.Money.MouseButton1Click:Connect(function(begin)
    	local Cash = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Cash")
    	clicked = true
    	if clicked then
    		Cash.Value = Cash.Value + math.Random(1,10000)
    		wait(86400)
 clicked = false
    		script.Parent.Money.MouseButton1Click:Connect(function()
    			script.Parent.Visible = false
    		end)
    	end
    end)

u used a debounce wrong

It is a local script
I am typing this bc this reply needs to be above 30

Can you show the explorer? aaaaaaaaaa

If the script only works once, then breaks after, then, the only reason you can’t click it again is because the wait statement is a long time.

Sure image

Yeah its suppose to be like that, its a daily reward

So does the script just fail???

Yeah but there doesn’t seem to be any errors I am gonna look over it again rq

Sometimes MouseButton1Click doesn’t work. Try MouseButton1Down.

Thank you its working now!
needs to be over 30

What needs to be over 30???

He’s talking about the words limit thingy.

My reply’s need to be over 30
eeeeeee

But I’m still surprised mousebutton1click sometimes wont work. I use it all the time and it works just fine.

I don’t recommend using wait, because the player can rejoin easily and get award again.

Yeah idk I use mousebutton1click most of the time, it was probably a bug or something

How would I make it so that won’t happen? I mean like what could I use besides wait to prevent that from happening?

You can use datastores and os.time()