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

How do I make it so you can a single part multiple times, then make it delete?

For example, I have a script here:

"function onClicked() script.Parent:remove() end

script.Parent.ClickDetector.MouseClick:connect(onClicked)"

Let's say I wanted the player to click that part 50 times, then have it delete. How would I script that?

1 answer

Simple! Try this out:

local hits = 0 -- this is how we will define how many times the player has clicked it

function onClicked() 
	hits = hits + 1 -- we add to hits everytime they click it
	if hits == 50 then
		print("50 hits!")
		script.Parent:Destroy() 
	end
end

script.Parent.ClickDetector.MouseClick:Connect(onClicked)

Please accept this answer if this helps!

1 comment

0

what he said

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