My game decides to implode with bugs if I use a fps unlocker

local part = workspace.Part

image
Use WaitForChild to wait for instances to replicate to the client.

camera.CFrame = CFrame.new(targetCameraPosition, part.Position) 

Use the CFrame.lookAt constructor, it’s more readable and expects two ‘Vector3’ values.

wait(2)

The wait global function is deprecated (it throttles), use the task library function of the same name.

I’d argue that the arbitrary wait isn’t even necessary.

part.Position += Vector3.new(0, targetStudsToMove, 0)

This should be a CFrame property assignment as they are considerably more performant.

part.CFrame *= CFrame.new(0, targetStudsToMove, 0)

A minor nitpick but connect a locally defined function rather than an anonymous one.

1 Like