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 2 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 552 — 2mo

Hi.

Looks like you're using an ad blocker.

That's fine...

No, it really is.

Just, I mean, we put a lot of work into this site, you know?

It would be really really appreciated if you would turn off your ad blocker for our website...

We tried really hard to make our ads as unobtrusive as possible.

If you really hate ads, would you consider a $2 donation via Patreon?

Here's the link.

We love you. We hope you love us too.

.

..

...

Now back to your regularly scheduled Scripting Helpers....

...

..

.

1 answer

Log in to vote
0
Answered by
SpyGuyTBM 552
2 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 1005 — 2mo
0
Oh, so sorry for not responding. This should be placed in starter player scripts SpyGuyTBM 552 — 2mo
Ad

Answer this question



Ad