Camera Manipulation and Different Scenes

Hello! I am relatively new to scripting and I need help on something.

Side Note: I have made 1 other post on something similar to this, so sorry if it seems like I am repeating posts. I also feel a bit guilty for making so many scripting support posts, but I am kind of new to scripting so I need a lot of help.

What I Want to Achive

I want to make a camera menu. This would be for viewing different areas of a theater. So for instance, clicking a right arrow UI and it changes the camera. You would be easily able to exit the camera mode.

What I Have so Far

local Camera = game.Workspace.CurrentCamera 
local Player = game.Players.LocalPlayer
 
repeat wait() until Player.Character or Player.CharacterAdded:Wait()

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

end)
4 Likes

Updated the script.

The CameraType should be an Enumerator; Enum.CameraType.Scriptable

Also the Player.Character should be repeat wait() until Player.Character or Player.CharacterAdded:Wait().
Just in case the Character hasn’t loaded in yet it will wait until it has.

1 Like

I am slightly confused on why you would put Enum before CameraType.Scriptable, because you would be setting the camera to Scriptable so, CameraType = Scriptable is right. (i think)

Oh I meant like “Camera.CameraType = Enum.CameraType.Scriptable” sorry for not explaining fully. e.e

Okay sorry lol

1 Like

Is this right?


or can I not script lol

no it should be repeat wait() until Player.Character or Player.CharacterAdded:Wait(), because it will loop until it meets the certain condition, in this case the “condition” is Player.Character or Player.CharacterAdded:Wait() Again, I’m so sorry for not explaining. I’m horrible at it.

Oh I see what you where saying. Thanks.

Okay in game I have this script. So basically when you press the button the angle shows. Does everything look alright?

The second to last “end)” at the bottom will break the script since there’s no reason for another end) in the script. xd I wish I could reword stuff better but it just won’t work e.e

1 Like

As a side note i don’t think you need to wrap the Player.Character or Player.CharacterAdded:Wait() in a loop, because the point of Player.CharacterAdded:Wait() is to wait until the character has loaded and it essentially yields the script in the same way repeat until does. So i’m pretty sure just using this:

Player.Character or Player.CharacterAdded:Wait()

works just fine on it’s own, btw the way you would need to add an if statement

2 Likes


It still doesn’t work. The ‘or’ is underlined in red. (I had to draw that bc my screenshot tool did not get the red line.

You would have use an if statement, Player.Character is a value

if Player.Character or  Player.CharacterAdded:Wait() then
--------Code
end
1 Like

Oh sorry lol. Kinda stupid on my part.

Or won’t work because there is no if statement or anything to check if one condition OR another is true/false equal to another value, etc. It should be either Player.CharacterAdded:Wait() or if Player.Character or Player.CharaterAdded:Wait() then

1 Like

When I play and press the spectate button nothing happens. There is no output error either. This is my script. No red lines or anything…

Is this in a server script or local script? Because if it’s in a serverscript it won’t work.
Also is this in a text button? I’ve made scripts in text labels before thinking it was a text button lmao.

O wait I just noticed, Camera.CFrame needs to be set equal to another CFrame value.

Camera.CFrame = CFrame.new(game.Workspace.CamPart.CFrame)

Lmao it was in an image label.

1 Like

It still doesn’t work. There is no output error or anything.
Here is an image of the camera (CamPart).