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 the script stop once i click 5 times?

i make this basic script

tool = script.Parent
player = game.Players.LocalPlayer:GetMouse()
block = game.Workspace
number = 1


maTable = {block.one,block.two,block.three}


tool.Equipped:connect(function(eventMouse)
	
	
	eventMouse.Button1Down:connect(function()
		for i,v in pairs (maTable) do
            number = 1 + 1
			v.Transparency = 1
			wait (1)
			v.Transparency = .5
			if number == 5 then
				break
			end
		end
	end)
end)

how do i make it to stop until i clicked 5 times?

1 answer

✓ Accepted answer

It'd be good if there was more of an explanation.

My only guess is that you want to disable the script permanently once it has been clicked five times.

tool = script.Parent
player = game.Players.LocalPlayer:GetMouse()
block = game.Workspace
number = 1


maTable = {block.one,block.two,block.three}


tool.Equipped:connect(function(eventMouse)
    eventMouse.Button1Down:connect(function()
	if number < 5 then
		number = number + 1
        	for i,v in pairs (maTable) do
        	v.Transparency = 1
        	wait (1)
        	v.Transparency = .5
        	end
	else
		script.Disabled = true
	end
    end)
end)

It'll run the transparency code provided 'number' is less than 5. If number is not less than five, it will disable the script.

Hope this helped.

Thanks,

Explosion

5 comments

0

oh wow thanks, i didnt know you can script.Disabled thanks :)

0

wait it doesnt worked i can still clicking and the part still keep transparency

0

This won't work because you're always setting number to 2. Change the number = 1+1 to number = number +1

0

Edited script.

0

I missed it whilst doing it.

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