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

Changing camera position loop kills player?

Asked by 3 years ago
Edited 3 years ago

I'm trying to set the camera to a specific location and looking straight down. I managed to make the camera move and look down, but the player instantly gets killed when they spawn in.

This is my script:

wait(.5)
while not game.Players.LocalPlayer.Character:FindFirstChild('Head') do wait() end

local cam = workspace.CurrentCamera
cam.CameraType = "Custom"
cam.CameraType = "Scriptable"

local RunService = game:GetService('RunService')
while RunService.Stepped:wait() do
    local head = game.Players.LocalPlayer.Character:FindFirstChild('Head')
    cam.CFrame = CFrame.new(Vector3.new(-40, head.Position.y + 45, 8), game.Workspace.floor.Position)
end

Thanks.

Answer this question