My CameraPart works in studio but not in the client

So i am making a basic menu for my roblox game and i have a CameraPart to set the scene.
When i run the game in studio it works perfectly

but when i test it out on normal roblox published this is what it looks like

so i do not understand why it does not work

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

repeat wait() until Player.Character

Camera.CameraType = "Scriptable"
Camera.CFrame = game.Workspace.CamPart.CFrame

script.Parent.Enabled = true

6 Likes

Are there any errors in the output? You need to press ‘F9’ to see them.

I wouldn’t do busy waiting like you did here:

repeat wait() until Player.Character

Camera.CameraType = "Scriptable"
Camera.CFrame = game.Workspace.CamPart.CFrame

Simply change it to

Player.CharacterAdded:Wait() -- more efficient solution to wait for something

Camera.CameraType = Enum.CameraType.Scriptable -- I prefer to use the Enum here
Camera.CFrame = workspace.CamPart.CFrame -- game.Workspace is the same as workspace
2 Likes

Sorry it did not fix the issue but thanks for trying.
Much appreciated!!

1 Like

It looks like you forgot to anchor the Camera part.

4 Likes

Are there any errors or other scripts that could potentially affect the CamPart?

1 Like

OMG YOU ARE A GOD!!
I am so stupid XD thank you so much i would have never of thought of that

3 Likes

Hey, you can checkout my plugin, it works with the same principle just with better features !

2 Likes

If its just you forgetting to anchor the part then it wouldn’t work in studio as well. You probably forgot to publish the game.

1 Like