Camera intro bug,

Hey, So I have tried making a simple intro where the players camera is taken to look at a small piece of land that I’ve made, Everything works perfectly fine in studio which i was alright with but upon loading into Roblox to see how everything runs there. That’s where my complications start.

IN Studio

Image

OUT Studio

Image

Note;
If anyone is willing to help, All I’m looking for is the camera to stay at a fixed position until the user presses play and then continue with gameplay. And the issue im facing is the users camera isnt showing at the place id like it to. Anyways, Thanks

Current code im using for the camera

local PB = script.Parent.Frame.Play
local QB = script.Parent.Frame.Leave

local Camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer

repeat wait() until Player.Character

Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = game.Workspace.StartMenuCamera.CFrame

script.Parent.Enabled = true

local function Play()
	script.Parent:Destroy()
	Camera.CameraType = Enum.CameraType.Custom
end

local function Leave()
	game.Players.LocalPlayer:Kick("You chose the easy way. You can rejoin though,")
end

PB.MouseButton1Down:Connect(Play)
QB.MouseButton1Down:Connect(Leave)

Note, Line 12:
script.Parent.Enabled = true

Isn’t really necessary since the script is always active

Most always when something works in studio but not in an actual game, its an issue with timing. Studio has no lag.

Realizing I have not looked over your script, so this might not pertain to you, but maybe see if you need to wait a little bit before setting the camera to look at the intro land.

Copied your code into studio, published the place, then joined it.
It seems to work fine with no issues

So, maybe there is some other script in your place that is messing things up.

Could be, But there is only two camera scripts, Each of which change the camera to a scriptable and then position it,

local PB = script.Parent.Frame.Play
local QB = script.Parent.Frame.Leave

local Camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()

Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = game.Workspace.StartMenuCamera
Camera.CFrame = game.Workspace.StartMenuCamera.CFrame

PB.MouseButton1Down:Connect(function(Play)
	script.Parent:Destroy()
	Camera.CameraType = Enum.CameraType.Custom
end)

QB.MousButton1Down:Connect(function(Leave)
	Player:Kick("You chose the easy way. You can rejoin though,")
end)

I really just cleaned up your code a bit, like you said, line 12 was not really necessary.

Let me know if this helps :slightly_smiling_face:

Ill try it now, And ill let you know thanks

1 Like

Yeah tried it, Didn’t work, I don’t know if there needs to be delay for when the camera is set, I have tried debugging it myself by doing

repeat
	c.CameraType = Enum.CameraType.Scriptable
	
until c.CameraType == Enum.CameraType.Scriptable

But it still doesn’t work

Edit: Just noticed an error in the output :
Unable to assign property CameraSubject. Object expected, got CFrame

Sorry, that was my fault. I edited the script now, so you can try it again if you’d like.

What is the line for the Player’s Character for? I don’t see a use for it in the script…

Yeah i removed the CFrame part myself, So far so good, Ill just rejoin cause there was a chance it would work before. But other than that its perfect

1 Like

“What is the line for the Player’s Character for?”

Honestly i have no idea, i coded this at like 4 in the morning around

And it works thank you for your help really appreciate it :smile:

1 Like