Enable rotating parts only if a player is near them

Hello, I just made an Obby which has some rotating and moving parts. The server starts to lag because the Obby is kinda long and I can’t find a way to enable the traps only if needed - for example if a player is in that stage. Could someone help me?

1 Like

Touch Sensors, Proximity Prompts, Raycasting, Region Detection, Location Detection, Client-Side Rendering, Zone Module, StreamingEnabled.

Look up these concepts for details. These are just a few …
Considering you’re talking about huge obby, the 1st 4 I listed are a great start.
Definitely look into StreamingEnabled also.

1 Like

If you wanna be fancy you can use zones and listen to player entering them (this is community module) or if you want it just to work, you could loop with distance check

1 Like

You can use for loop in pairs to loop through the players character and find there HumanoidRootPart and Magnitude it with the part it like (Part.Position - HumanoidRootPart.Position).Magitude and check if the distance is near by studs or you can use Zone like they said.

3 Likes

insane, thank you so much! and also thanks to the others who responded!

1 Like

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