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

How to put a camera at a part for every players with a script in serverscript ?

wait(1)
local camera = workspace.CurrentCamera
local part = script.Parent.Workspace.CamPart
	

for _, player in pairs(game.Players:GetChildren()) do
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CameraSubject = part
	print("Camera Work")
end

I have try this script and it only print "Camera Work" but it not changing the camera

i just wanna know if there a way to use a script to change the camera for players

2 answers

you get the CurrentCamera from workspace, in order to "put" camera somewhere, you need to give it a new location, position / cframe.

You can change the camera by change the camera CFrame.

wait(1)
local camera = workspace.CurrentCamera

camera.CFrame = workspace.CamPart.CFrame

If you want the camera to follow CamPart do this

wait(1)
local camera = workspace.CurrentCamera

local runService = game:GetService("RunService")
runService.RenderStepped:Connect(function()
	camera.CFrame = workspace.CamPart.CFrame
end)

Update camera on RenderStepped to get smooth motion.

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