Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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.

0
Do you mean change the camera subject? User#5423 17 — 6y
0
Yes @kingdom5 Chez_Guy 67 — 6y
0
Did you do this using a LocalScript? KingLoneCat 2642 — 6y
0
@KingLoneCat no Chez_Guy 67 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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!

Ad

Answer this question