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

Is there a way to change camera position without using CurrentCamera.Subject?

I've been trying to change the camera's position but everytime it just sort of 'teleport' to the player's back no matter what angle i look at.

i tried this:

local cam = workspace.CurrentCamera

cam.CFrame = CFrame.new(10,50,10)

but the thing mentioned above happens

1 answer

you can put the cameras CFrame on a part, instead of a position, so just make a brick and make sure the front face is facing whatever you want and you can rotate it, then put a local script in startergui, bc only clients can access it, and type this:

local camera = workspace.CurrentCamera
local part = workspace.Part -- ur part here
local player = game.Players.LocalPlayer
local character = player.Character or player.Character:Wait()

wait(0.1)
repeat
	camera.CameraType = Enum.CameraType.Scriptable 
until camera.CameraType = Enum.CameraType.Scriptable

camera.CFrame = part.CFrame -- sets CFrame on the part

i also think that you can replace it with position the camera, because you didnt set the cameratype to scriptable. If u wanted to change the players camera to normal, just do this:

local camera = workspace.CurrentCamera
local part = workspace.Part  

wait(0.1)
camera.CameraType = Enum.CameraType.Scriptable  
camera.CFrame = part.CFrame

script.Parent.MouseButton1Click:Connect(function()
	camera.CameraType = 'Custom'
end)

you can put the script inside a textbutton

3 comments

0

Nothing happened. i wrote the exact script and it didn't do anything. i added a print on line 7 to be sure and nothing showed up in the Output

0

use a repeat loop instead

0

try the script again, bc i edited so it will wait for the character

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