I'm trying to set the camera to a position on player spawn, and this is the code I'm currently using, but sometimes it doesn't actually set the camera to the CFrame of the cameraPart and then resets back to the player's view. Any ideas?
local camera = workspace.CurrentCamera
repeat wait ()
camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable
camera.CFrame = workspace.locationA.cameraPart.CFrame

1 comment
wait() is a code smell. wait() can be replaced with game.RunService.Heartbeat:Wait()