Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to detect the player is clicking & holding ?

So i have a gui button and i want to create a easter egg function by clicking and holding it for 2 second This is a script i currently have in my mind

script.Parent.MouseButton1Down:Connect(function()
if script.Parent.MouseButton1Up then
else
wait(3)
--Secret function
end
end)

Idk if that works. Is there a better way of doing this ? Thanks for reading, hope you could help :D

1 answer

✓ Accepted answer
script.Parent.MouseButton1Down:Connect(function()
	local isholding = true
	script.Parent.MouseButton1Up:Connect(function()
		isholding = false
	end)
	wait()
	if isholding then
		--Secret Function
	end
end)

1 comment

0

Oh i will try it out, thanks ! (I will accept if it works)

This discussion is preserved as it was. New answers, comments, and votes are closed.