Best way to make a sliding door?

Hi, so I found this pretty interesting. I rewrote code for a generic grocery store sliding door thing, and I’m very surprised it lags very bad when ever it slides open or closes.

I used CFraming to shift it, but I’ve simplified the code alot but apparently that had no impact, it still lags horribly. It sounds complex to figure out a way to replicate the moving of the doors to each client instead of doing it server-sided, so I’m trying to figure out what’s the most ideal way to create moving doors like this…perhaps using constraints and setting their angle properties? Not really sure here. :confused:



Maybe try using a PrismaticConstraint set to the Servo mode?

1 Like

I found a tutorial on YouTube made by @Alvin_Blox:

The door shown in the video doesn’t lag when opening/closing, so perhaps you could use the scripts shown in this video as reference?

Hope this helped you out.


I’d recommend using TweenService for moving objects, and knowing how to create one. If you’re attempting to make the sliding door so when the player is nearby, I’d recommend using .Magnitude to check the player’s magnitude and game:GetService("RunService").RenderStepped:Connect(function() to check their magnitude every frame.