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

Why is the camera not following my mouse lookvector?

wait(1)

local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local mouse = player:GetMouse()
mouse.Move:Connect(function()
camera.CFrame = CFrame.new(mouse.Hit.lookVector * 5)
print(CFrame.new(mouse.Hit.lookVector * 5))
end)

Why is the camera stuck in position and is not following the camera? the printed message changes when i move the mouse,but not the camera.

1 answer

✓ Accepted answer

You need to set the camera type to CameraType.Scriptable if you do not set it to Scriptable you are not allowed to edit the camera using a script

wait(1)

local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local mouse = player:GetMouse()
camera.CameraType = Enum.CameraType.Scriptable

mouse.Move:Connect(function()
camera.CFrame = CFrame.new(mouse.Hit.lookVector * 5)
print(CFrame.new(mouse.Hit.lookvector * 5))
end)

1 comment

0

Could you explain why it doesn't work without it?

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