So I have this intro script that works 75 percent of the time, and was working fine a few minutes ago, I don’t think this is an effective way tho, as sometimes the camera does not load properly, showing your character. any help? Here is part of the script.
--// Client
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera
game.Lighting.Blur.Size = 15
local ready = false --added
local count = 0 --added
--// GUIs
local PlayButton = script.Parent.PLAY
--// Main
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CameraType = Enum.CameraType.Scriptable
repeat wait() until script.Parent.Parent == game.Players.LocalPlayer:WaitForChild("PlayerGui")
repeat wait()
Camera.CFrame = game.workspace.CameraPart.CFrame
until Camera.CFrame == game.workspace.CameraPart.CFrame
Camera.CFrame = game.workspace.CameraPart.CFrame
Could you provide a video/gif of the incident happening? Also, there’s some inefficient coding practices here. You shouldn’t need to use a repeat until statement for each bit as you’re waiting until character is added anyways.
Instead of game.Players, use game:GetService("Players") as well. (Nothing important for this, just good practice.)
EDIT: A photo of the explorer would be helpful to see your UI setup.
I think the mistake you made was forgetting to use :WaitForChild(). Waiting for the character to load won’t guarantee that the GUIs or client-sided parts are also loaded. I am pretty sure the worspace start loading first, after that the character and at the last the UIs- not sure if it is 100% true, correct me if I’m mistaken.
At the part where you put local PlayButton = script.Parent.PLAY try using local PlayButton = script.Parent:WaitForChild(“PLAY”)
and at Camera.CFrame = game.workspace.CameraPart.CFrame use Camera.CFrame = game.workspace:WaitForChild(“CameraPart”).CFrame
There is usually a glitch with this because the script moves to fast, so the combat it, we place a wait() between setting the CameraType and the Subject. And instead of using Camera.CFrame use Camera.CoordinateFrame (not sure of the significance since they’re basically the same thing), but set the CoordinateFrame to the position of CameraPart not the CFrame.
I’m not sure if this will help you, but let me know how it goes.