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?
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?
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!
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
what he said