Cannot change camera to "fixed"

hello robloxians,
i am working on a team select ui and when i just checked the ui so the camera cant change by click to “fixed camera” sombody can tell me why?

here is the script:

local player = game.Players.LocalPlayer

script.Parent.POB.MouseButton1Click:Connect(function()
player.Team = game.Teams.Police
script.Parent.Parent.Visible = false
repeat wait(0.5)
game.Workspace.Camera.CameraType = Enum.CameraType.Fixed
until game.Workspace.Camera.CameraType == Enum.CameraType.Fixed
end)

script.Parent.EVB.MouseButton1Click:Connect(function()
player.Team = game.Teams.Evil
script.Parent.Parent.Visible = false
repeat wait(0.5)
game.Workspace.Camera.CameraType = Enum.CameraType.Fixed
until game.Workspace.Camera.CameraType == Enum.CameraType.Fixed
end)

script.Parent.PRB.MouseButton1Click:Connect(function()
player.Team = game.Teams.Prisoner
script.Parent.Parent.Visible = false
repeat wait(0.5)
game.Workspace.Camera.CameraType = Enum.CameraType.Fixed
until game.Workspace.Camera.CameraType == Enum.CameraType.Fixed
end)

1 Like

You’re using “Workspace.Camera” where you should be using “Workspace.CurrentCamera”. Change all instances of the former to the latter and you’re set as far as resolving this issue goes.

Further reading:

2 Likes

while i start play the camera is “fixed” and when i am click the button the camera is scriptable…

here is a link to the game: Game 516 - Roblox

That’s an issue you can fix by reviewing your code carefully and checking to see if you’re setting the right CameraType where appropriate. Spend some time checking over your own code. I can’t hand you the answer for small problems like this. It doesn’t teach you anything.

here is where the camera will set to fixed:


and here to scriptable:
and set camera position on select team:

When you want to edit what the Camera is seeing in the CoordinateFrame set the CameraType to scriptable.

When you want the camera to reset and be on the players character, set the CameraType to custom.

1 Like

To learn more about CameraType and what each one does, look into this post.

1 Like