1.) Use TweenService for animations: Instead of using task.wait() to pause the script for a certain amount of time during an animation, you could use TweenService to create smoother and more precise animations. TweenService can interpolate between two values over a specified amount of time, making it ideal for camera movements and other animations.
2.) Use a Coroutine: Instead of using a while loop to perform the blinking animation, you could use a coroutine. Coroutines allow you to pause and resume execution of a function, making it easier to manage complex animations and other asynchronous tasks.
local TweenService = game:GetService("TweenService")
CameraHandler.SetCameraTypeAsync(Enum.CameraType.Scriptable)
CameraHandler.SetCameraPosition(HiddenMapCameraAngles.RoomAngle1)
CameraHandler.SetRobloxCore(false)
local function playIntroCutscene()
local alarmClockSound = AlarmClockSound:Play()
wait(5)
local roomAngle1Tween = TweenService:Create(HiddenMapCameraAngles.RoomAngle1, TweenInfo.new(7.5), {
CFrame = CFrame.new(Vector3.new(35.55, 3.45, -5.15))
})
roomAngle1Tween:Play()
wait(7.5)
BlinkHandler.StopSleeping()
local cameraTween = TweenService:Create(CameraHandler, TweenInfo.new(5), {
CameraRotation = Vector3.new(-40, 90, 0),
CameraPosition = HiddenMapCameraAngles.RoomAngle1,
})
cameraTween:Play()
wait(5)
local cameraRotationTween = TweenService:Create(CameraHandler, TweenInfo.new(5), {
CameraRotation = Vector3.new(40, -90, 15),
})
cameraRotationTween:Play()
end
playIntroCutscene()
local function performBlink()
while ShouldBlink do
BlinkHandler.PerformBlink(1)
wait()
end
end
spawn(performBlink)
Try this code let me know if you reach any errors.