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

how do i make the camera set to a Dummy's head?

Asked by 3 years ago

so i'm making an animation, from a dummy POV (camera is set to dummy head). I'm not so experienced in scripting so i thought i would ask here.

how would i do that? i tried using cframe but it doesnt work.

local camera = game.Workspace.CurrentCamera
local dum = workspace.Dummy.Head

game.ReplicatedStorage.SetHeadToDummy.OnClientEvent:Connect(function()
    camera.CameraType = Enum.CameraType.Scriptable
    camera.CFrame = dum
end)


1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

You need to set the CFrame to the dummy's head CFrame. Since the camera will be constantly moving, you will need to fire it every frame using RenderStepped.

local camera = game.Workspace.CurrentCamera
local dum = workspace.Dummy.Head
local RunService = game:GetService("RunService")

local function updateCamera()
    camera.CameraType = Enum.CameraType.Scriptable
    camera.CFrame = dum.CFrame
end

game.ReplicatedStorage.SetHeadToDummy.OnClientEvent:Connect(function()
    RunService.RenderStepped:Connect(updateCamera)
end)

There might be a better way to do this but this is what I would do. Let me know if this works.

0
tried firing the remote event via the developer bar, doesnt seem to work. do i need to put the local script in a certain location? IlLupoMannaro34 7 — 3y
0
I put it in starter character scripts and tested it. Worked fine for me. LeedleLeeRocket 1257 — 3y
0
oh. thank you. i had it in the wrong location. IlLupoMannaro34 7 — 3y
Ad

Answer this question