Scripts may lag the game depending on the code used on them.
Some of the stuff I know that impact game’s performance(Not lag in some cases) are :
RunService.HeartBeat TweenService Instance.new() Destroy() while true do wait() end coroutine wait() FindFirstChild("X", true) RunService.RenderStepped Clone() repeat wait() until x
(If I’m wrong on the examples above, correct me.)
Do you know any other type of code that can impact game’s performance?
Any code that is run multiple times aka any loops can cause problems if used wrongly.
You can see that what scripts are problematic in studio under Script performance tab or in live games in the mirco profiler.
80% of these will not impact performance that much if you do it correctly, don’t leave loop running when they are not used this will cause memory leak. There is nothing wrong with RenderStepped and Heartbeat. I haven’t heard :Clone() and :Destroy() causing performance to go down. TweenService can cause lag when using it too much on the server and can cause the Tween to slow down. With Instance.new if you use the second parameter it will impact performance as shown here. Please correct me if I’m wrong.