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

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

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

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.

3 comments

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?

0

I put it in starter character scripts and tested it. Worked fine for me.

0

oh. thank you. i had it in the wrong location.

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