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

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

Asked by 5 years ago
Edited 5 years ago
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

Log in to vote
0
Answered by 5 years ago

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

Ad
Log in to vote
0
Answered by
OnaKat 444 Moderation Voter
5 years ago

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.

Answer this question