Ad
Log in to vote
0

How would I change the camera of the player and make it stay in a certain position?

Asked by 11 months ago

I want the camera to look down at the map. I have no idea how to do this since Roblox wiki doesn't explain how to Permanently make the camera stay in a position WITH OUT the player changing the camera after. I want the camera to stay in that position and never move. How would I do that?

Sorry this is like a script request but there's was only camera lock on objects in the Roblox Wiki.

0
Oh, so sorry for not responding. This should be placed in starter player scripts SpyGuyTBM 602 — 11mo

1 answer

Log in to vote
0
Answered by
SpyGuyTBM 602 Moderation Voter
11 months ago

http://wiki.roblox.com/index.php?title=Camera_manipulation

--LOCALSCRIPT
local cam = workspace.CurrentCamera
cam.CameraType = "Scriptable"

-- Note:Map is the map, set a primary part to it
Pos = Map.PrimaryPart.CFrame

--Note: High is how high the cam is above the map
High = --What ever you want



cam.CoordinateFrame=CFrame.new(Pos.X, (Pos.Y +High),Pos.Z)
cam.Focus=CFrame.new(cam.CFrame.X,(Cam.CFrame.Y - 1),cam.CFrame.Z)

So, normally, no one will write code for you, but this is an exception because I took most of this code straight out of the Wiki and tweaked it for you with comments and the variables.

If you dont understand what i am about to say , go to the link for more info and examples

so, since this is a local script, we can take the players current camera via workspace.CurrentCamera and turn it into a variable (cam)

Changing the cam's CameraType to scriptable takes all control away from the user.

What i personally added is, the pos variable. This gets the primary part of the map (which you should make the center of the map) and takes it's position. I also added High, how high above the map you want the camera to be.

I then make the cam's postion the map's X and Z, then I add the height to the Y axis. I then make the camera look down by making the camera focus one stud below it.

You can do some awesome stuff with scriptable cameras! You can even make it cooler using trignometry to make the camera zoom in and out when players move closer and farther from each other!

0
Where would I place this script? BlackOrange3343 1720 — 11mo
0
Oh, so sorry for not responding. This should be placed in starter player scripts SpyGuyTBM 602 — 11mo
Ad

Answer this question