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

How do you make "lol"only prints once, not like over 100 times?

Why is "lol" printed a lot more than 1 time like over 100 times, and how do you make it so it only prints once? It has to stay in the loop so it can check for the button.

while wait(0.03125) do
	if player.PlayerGui.ScreenGui:FindFirstChild("JumpPowerTextButton") then
		player.PlayerGui.ScreenGui.JumpPowerTextButton.MouseButton1Down:connect(function()
	print("lol")
end)
	end
end

1 answer

✓ Accepted answer

You're using a while wait loop. Instead use a while true loop.

while player.PlayerGui.ScreenGui:FindFirstChild("JumpPowerTextButton") do
	wait(.03125)
	player.PlayerGui.ScreenGui.JumpPowerTextButton.MouseButton1Down:connect(function()
		print("lol")
	end)
end

1 comment

0

While wait runs the script every .03125 seconds whether or not the if then statement returns true.

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