Client-Side clickdetector detection

The title may have been a bit confusing so I will elaborate. So basically I have about 85 doors in my game, and each door has a doorknob. I want each doorknob to have a ClickDetector inside of it that when clicked will tween the knob to rotate. The issue is, server-sided tweens look ugly and I don’t want to paste the same script into 85 doorknobs. I want the tween to be handled on the client. How do I go about doing this? How do I make the client know when the player clicks on a Clickdetector and which doorknob to rotate?

If that didn’t make sense, let me know and I will try to explain it more thouroughly

Loop through every door, and detect when the click detector is clicked. Then, send a RemoteEvent to every client to tween that door.

1 Like

Do I have to iterate over the entire workspace and check the names of each workspace object in order to find the doorknobs? Do to the specifications of my game, I cannot put the doors inside of a folder or group them together.

Use CollectionService and tag all of the doors. Then iterate over every tagged door.

2 Likes

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