Need help with the intro

So I have this intro script that doesnt end when changing the camera subject from the part to the humanoid, is the humanoid the wrong place to put the camera subject when ending the intro?

Could you please provide the code, so we can help fix it?

wait(0.1)
--// Client
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera
game.Lighting.Blur.Size = 15

--// GUIs
local PlayButton = script.Parent.PLAY

--// Main
    Camera.CameraType = Enum.CameraType.Scriptable
    Camera.CameraSubject = workspace:WaitForChild("CameraPart")

repeat wait() until script.Parent.Parent == game.Players.LocalPlayer:WaitForChild("PlayerGui")

repeat wait() 
Camera.CFrame = game.Workspace:WaitForChild("CameraPart").CFrame
until Camera.CFrame == game.Workspace:WaitForChild("CameraPart").CFrame
Camera.CFrame = game.Workspace:WaitForChild("CameraPart").CFrame

script.Soundsx:Play()
script.Parent.Seralee.ImageTransparency = 0
game:GetService("RunService").RenderStepped:connect(function()
	workspace.Camera.FieldOfView = 70 + script.Soundsx.PlaybackLoudness * 0.01
	game.Lighting.Blur.Size = script.Soundsx.PlaybackLoudness * 0.0185
	end)
	wait ()
	script.Parent.PLAY.Active = true
	script.Parent.PLAY.Visible = true
	script.Parent.Seralee.ImageTransparency = 1
	
	script.Parent.ImageLabel.ImageTransparency = 0.9
	wait ()
	script.Parent.ImageLabel.ImageTransparency = 0.8
	wait ()
	script.Parent.ImageLabel.ImageTransparency = 0.7
	wait ()
	script.Parent.ImageLabel.ImageTransparency = 0.6
	wait ()
	script.Parent.ImageLabel.ImageTransparency = 0.5
	wait ()
	script.Parent.ImageLabel.ImageTransparency = 0.4
	wait ()
	script.Parent.ImageLabel.ImageTransparency = 0.3
	wait ()
	script.Parent.ImageLabel.ImageTransparency = 0.2
	wait ()
	script.Parent.ImageLabel.ImageTransparency = 0.1
	wait ()
	script.Parent.ImageLabel.ImageTransparency = 0

PlayButton.MouseButton1Click:Connect(function()
	if Player:WaitForChild("leaderstats"):WaitForChild("DoneTest").Value == 1 then
	script.Parent.ImageLabel.ImageTransparency = 1
	script.Parent.ImageLabel.Visible = false
	script.Parent.ImageLabel.Active = false
	game.Lighting.Blur.Size = 15
	wait ()
	game.Lighting.Blur.Size = 12
	wait ()
	game.Lighting.Blur.Size = 9
	wait ()
	game.Lighting.Blur.Size = 6
	wait ()
	game.Lighting.Blur.Size = 5.5
	wait ()
	game.Lighting.Blur.Size = 5
	    script.Soundsx:Stop()
		PlayButton:Destroy()
	Camera.CameraType = Enum.CameraType.Custom
	elseif Player:WaitForChild("leaderstats"):WaitForChild("DoneTest").Value == 0 then
	Camera.CFrame = game.Workspace.CustomPart.CFrame
	Camera.CameraSubject = Character.Humanoid
	script.Parent.ImageLabel.ImageTransparency = 1
	script.Parent.ImageLabel.Visible = false
	script.Parent.ImageLabel.Active = false
	PlayButton:Destroy()
	game.Lighting.Blur.Size = 15
	wait ()
	game.Lighting.Blur.Size = 12
	wait ()
	game.Lighting.Blur.Size = 9
	wait ()
	game.Lighting.Blur.Size = 6
	wait ()
	game.Lighting.Blur.Size = 5.5
	wait ()
	game.Lighting.Blur.Size = 5
    script.Soundsx:Stop()
    game.Workspace.CustomizationGuiPart.SurfaceGui.GenderPick.Visible = true
    script.SoundCreation:Play()
    game.Workspace.CustomizationGuiPart.SurfaceGui.GenderPick.MaleButton.MouseButton1Click:Connect(function()
	Camera.CFrame = game.workspace.CustomPart.CFrame
	game.Workspace.CustomizationGuiPart.SurfaceGui.GenderPick.Visible = false
	game.Workspace.CustomizationGuiPart.SurfaceGui.GenderPick.Active = false
	local boi = game.ReplicatedStorage.HatDummy3:Clone()
	boi.Parent = game.Workspace
game.Workspace.CustomizationGuiPart.SurfaceGui.Skin.Visible = true
game.Workspace.CustomizationGuiPart.SurfaceGui.Skin.PLAY.MouseButton1Click:Connect(function()
	game.Workspace.CustomizationGuiPart.SurfaceGui.Skin.Visible = false
    game.Workspace.CustomizationGuiPart.SurfaceGui.Hats.Visible = true
    game.Workspace.CustomizationGuiPart.SurfaceGui.Hats.PLAY.MouseButton1Click:Connect(function()
	game.Workspace.CustomizationGuiPart.SurfaceGui.Hats:Destroy()
	script.SoundCreation:Stop()
	game.ReplicatedStorage.DoneTest1:FireServer()
	Camera.CameraSubject = Character.Humanoid
	Camera.CameraType = Enum.CameraType.Custom
		end)
end)
end)
	end
	end)
    game.Workspace.CustomizationGuiPart.SurfaceGui.GenderPick.FemaleButton.MouseButton1Click:Connect(function()
	Camera.CFrame = game.workspace.CustomPart.CFrame
	game.Workspace.CustomizationGuiPart.SurfaceGui.GenderPick.Visible = false
	game.Workspace.CustomizationGuiPart.SurfaceGui.GenderPick.Active = false
	local boi2 = game.ReplicatedStorage.HatDummy2:Clone()
	boi2.Parent = game.Workspace
game.Workspace.CustomizationGuiPart.SurfaceGui.Skin2.Visible = true
game.Workspace.CustomizationGuiPart.SurfaceGui.Skin2.PLAY.MouseButton1Click:Connect(function()
	game.Workspace.CustomizationGuiPart.SurfaceGui.Skin2.Visible = false
    game.Workspace.CustomizationGuiPart.SurfaceGui.Hats.Visible = true
   game.Workspace.CustomizationGuiPart.SurfaceGui.Hats2.Visible = true
   game.Workspace.CustomizationGuiPart.SurfaceGui.Hats2.PLAY.MouseButton1Click:Connect(function()
	game.Workspace.CustomizationGuiPart.SurfaceGui.Hats2:Destroy()
	script.SoundCreation:Stop()
	game.ReplicatedStorage.DoneTest1:FireServer()
		Camera.CameraSubject = Character.Humanoid
	Camera.CameraType = Enum.CameraType.Custom
	end)
		end)
end)
    game.Workspace.CustomizationGuiPart.SurfaceGui.Skin.Back.MouseButton1Click:Connect(function()
	game.Workspace.CustomizationGuiPart.SurfaceGui.Skin.Visible = false
	game.Workspace.CustomizationGuiPart.SurfaceGui.GenderPick.Visible = true
	game.Workspace:WaitForChild("HatDummy3"):Destroy()
		game.Workspace.MaleHats2.Afro.Transparency = 1
	game.Workspace.MaleHats2.Trecky.Transparency = 1
end)
    game.Workspace.CustomizationGuiPart.SurfaceGui.Hats.Back.MouseButton1Click:Connect(function()
	game.Workspace.CustomizationGuiPart.SurfaceGui.Hats.Visible = false
	game.Workspace.CustomizationGuiPart.SurfaceGui.Skin.Visible = true
end)
    game.Workspace.CustomizationGuiPart.SurfaceGui.Hats2.Back.MouseButton1Click:Connect(function()
	game.Workspace.CustomizationGuiPart.SurfaceGui.Hats2.Visible = false
	game.Workspace.CustomizationGuiPart.SurfaceGui.Skin2.Visible = true
end)
    game.Workspace.CustomizationGuiPart.SurfaceGui.Skin2.Back.MouseButton1Click:Connect(function()
	game.Workspace.CustomizationGuiPart.SurfaceGui.Skin2.Visible = false
	game.Workspace.CustomizationGuiPart.SurfaceGui.GenderPick.Visible = true
	game.Workspace:WaitForChild("HatDummy2"):Destroy()
	game.Workspace.FemaleHats2.Disney.Transparency = 1
	game.Workspace.FemaleHats2.Updo.Transparency = 1
	end)

First off, you do not need to set the camera subject in the first place. All you have to do is switch the camera’s type to scriptable.

Secondly, add print statements to make sure that your code actually reaches that point. It most likely has nothing to do with your camera but, but with your intro.

Well I did that to make sure the intro always works, because sometimes it does not, and only the gui loads, and it doesnt go to the camera part.

Try adding print statements. See how far your code goes. Use the output and tell us what prints.

Well it works most of the time, but sometimes it doesn’t, so I know the code works, it just not all the time.

You are not listening to me. If you want help, you have to be able to accept it. Please, put print statements throughout your code. This will help us figure out your problem. Otherwise, we can not help.

If the code does not work all of the time, then it does not work. There is a reason for that, which we can help with.

1 Like

Yea. Use Print() to check to see if the code gets passed a certain point. Your Intro has some unneeded code like @REALTimothy0812 said, just set the camera subject to scriptable

I dont know where I would put the print statements.

Peint statements are for debugging purposes. For example, they should print something useful.

However, I think I have found your problem. I’d you run this code off of startup, the camera type will not be successfully set sometimes.

Change this bit:

repeat wait() 
Camera.CFrame = game.Workspace:WaitForChild("CameraPart").CFrame
until Camera.CFrame == game.Workspace:WaitForChild("CameraPart").CFrame

To this:

repeat wait() 
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
1 Like

I did this and it worked, I hope this means it will work every time.

It should, as long as nothing else in your code conflicts with it. The problem was that sometimes the code would execute before roblox’s built in code did, so the camera type would be set back to normal. With the code that I whipped up, it makes sure that the value was actually set before moving on.

1 Like

Ohhh, I get that, thank you so much, this might have just saved my game.