Click Detector is Not Working

I want to make the flag down when I click the part but it is not working.


2 Likes

Off first looks, you have a loop running above your function so the script is occupied with the loop that is running. That is the reason your click function is not firing.

3 Likes

:MoveTo() only works on humanoids im pretty sure… Try tweening the posititon.

Either way, please provide some more context, add some print statements to figure out where the code is breaking.

3 Likes

Thanks for providing the code!

As REDGREIF said; your code is caught on the “while true do” loop - most generic loops will yield on the line that they are ended on, which in your case is line 21.

I also highly recommend taking Brylan_Leske’s suggestion to use TweenService instead of a while loop. It will greatly reduce the capacity of your code, and make it more manageable by using Tween’s built-in events.

Instead of MoveTo are you trying to use PivotTo? It is used to apply a new CFrame onto Model Instance’s.

3 Likes

For future posts that needs help with scripts, use #help-and-feedback:scripting-support

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.