Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can i change what the player sees? (Camera)

So i want to make something in my game that your camera isn't focused on the player. This is what i tried:

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

That whole script apparently didn't work,

Including the:

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

part.

Well, the thing is i don't know if it actually worked, but when i ran the game, the script popped up and had a little arrow pointing to the line of code, (at the very top, the first line) and i hovered my mouse over it and it said:

Error: Bad call

How come? If you have an answer, you know what to do.

4 comments

0

Do you mean change the camera subject?

0

Yes @kingdom5

0

Did you do this using a LocalScript?

0

@KingLoneCat no

1 answer

I think you're trying to change the cameras CoordinateFrame.

This will change the cameras position to the parts CFrame:

--LocalScript
workspace.CurrentCamera.CoordinateFrame = workspace.CamPart.CFrame

The camera will face towards the front surface of the part it is being attatched to. Now lets add a RenderStepped function:

--LocalScript
game:GetService("RunService").RenderStepped:connect(function()
	workspace.CurrentCamera.CoordinateFrame = workspace.CamPart.CFrame
end)

RenderStepped is to continually attatch the camera to that part. Without it, the cameras CoordinateFrame will only be attatched once and will be able to move freely afterwards.

Please upvote if helped!

This discussion is preserved as it was. New answers, comments, and votes are closed.