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

How do i make a script where you can only click a part with a clickdetector twice? (more in bio)

I need a script where you only can press the part that has a ClickDetector in it a certain amount of times, for each player. This is the script so far, any help appreciated. Thank you in advance.

``script.Parent.MouseClick:Connect(function()
		if Character:WaitForChild("Humanoid").WalkSpeed + 76
	end
end)``

1 comment

0

This script is uncompleted, you are missing "then" and if line is double tabbed.

1 answer

✓ Accepted answer

Well my guess is that you wanted the player to be able to click it only twice. heres a little script that you can build off of.

local TimesLeftToClick = 2

script.Parent.MouseClick:Connect(function(Player)
	if TimesLeftToClick >= 1 then
		TimesLeftToClick = TimesLeftToClick - 1
		Player.Character:WaitForChild("Humanoid").WalkSpeed = Player.Character:WaitForChild("Humanoid").WalkSpeed + 76
	end
end)

1 comment

0

Thank you, it worked.

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