I had an idea where I could use a GUI to move the camera around a menu screen. So when I press about, The camera would move towards the point where the about point would be. however I have no clue how to move the camera from point A to Point B. I know how to set them, just not move them. I do however have a feeling that I'm supposed to use loops to move the camera around. I have placed the GUI's down just not set them yet in the script, I do know how to set them. Here is what I have: (This is in a Local Script)
local Menupos = workspace.Menu.PMenu.Position local Aboutpos = workspace.Menu.PAbout.Position local Playpos = workspace.Menu.PPlay.Position local Lookpos = workspace.Menu.LookC.Position -------------------------//Main Script\\-------(There is where stuff happens!)----------------------------------- -----//Varialbes// plr = game.Players.LocalPlayer cam = game.Workspace.CurrentCamera cam.CameraType = Enum.CameraType.Scriptable chr = nil Menu = game.Workspace.Menu.PMenu About = game.Workspace.Menu.PAbout Play = game.Workspace.Menu.PPlay LookAtCenter = game.Workspace.Menu.LookC plr.CharacterAdded:connect(function(character) chr = character end) VMenu = game.Workspace.Menu.Menu.Value VAbout = game.Workspace.Menu.About.Value VPlay = game.Workspace.Menu.Play.Value VGone = game.Workspace.Menu["Menu Gone"].Value -----//Actual Script// if VMenu == true then cam:remove() wait(2) cam.CameraSubject = Menu cam.CoordinateFrame = CFrame.new(Menupos,Lookpos) cam.CameraType = "Scriptable" end if VAbout == true then wait() cam:remove() wait(0.1) cam.CameraType = "Scriptable" wait() cam.CameraSubject = About cam.CoordinateFrame = CFrame.new(Aboutpos,Lookpos) end if VPlay == true then wait() cam:remove() wait(0.1) cam.CameraType = "Scriptable" wait() cam.CameraSubject = Play cam.CoordinateFrame = CFrame.new(Playpos,Lookpos) end
So would you need like a for loop to move the CoordinateFrame using +0.1 or something?
Using loops is plausible, but it's very long and tedious, not to mention inefficient. Check out the Interpolate method of the camera. It basically tweens the camera to the position
You can set where the camera will be by the end of the interpolation, how long it'll take to do it, and where it'll end up looking at. It's a very smooth transition.
http://wiki.roblox.com/index.php?title=API:Class/Camera/Interpolate
Obviously you need to set the camera type to Scriptable.