Problem
the problem is that you're creating a indefinite while loop over the code, which makes it yield the thread for a indefinite amount of time unless you break it or the condition in it turns false which you cant do that since you set the condition of the loop as the wait()
method. also you can just use workspace.CurrentCamera
instead, which is the client's camera and theres no need for a while loop anyways. use a for loop instead of setting the transparency each time or you could use TweenService
for a smoother effect and more options.
02 | local play = script.Parent.Play |
03 | local chapter = script.Parent.Chapter |
04 | local title = script.Parent.Title |
05 | local fader = script.Parent.Fade |
06 | local campart = workspace.Cameras:WaitForChild( "JoinedCam" ) |
07 | local camera = workspace.CurrentCamera |
08 | local player = game.Players.LocalPlayer |
09 | local char = player.Character or player.CharacterAdded:Wait() |
11 | camera.CameraType = Enum.CameraType.Scriptable |
12 | camera.CFrame = campart.CFrame |
17 | fader.BackgroundTransparency = i |
29 | play.MouseButton 1 Click:Connect( function () |
31 | chapter.Visible = false |
33 | camera.CameraType = Enum.CameraType.Custom |
34 | workspace.Cameras.JoinedCam:Destroy() |
35 | char.HumanoidRootPart.CFrame = CFrame.new(- 553.1 , - 35.9 , - 24 ) |
and HumanoidRootPart
isnt a object of the player object (game.Players.LocalPlayer) but the player's character.