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

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

Asked by 5 years ago

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

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

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

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 GamingOverlord756 48 — 5y
0
use a repeat loop instead User#23365 30 — 5y
0
try the script again, bc i edited so it will wait for the character User#23365 30 — 5y
Ad

Answer this question