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

Camera Help| Camera Face Players Front?

Asked by 9 years ago

Idea This camera script flips from top-down to locking in front of them while locking the players character.
Problem The Problem is that when the player is anchored they dont always face the camera.
Camera Scripted

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')
    local distance = script.DistanceFromHead.Value
    if script.Parent.Parent.PlayerStats.Playing.Value == true then
    cam.CoordinateFrame = CFrame.new(Vector3.new(head.Position.x - 0.001, head.Position.y + distance, head.Position.Z),head.Position)
        elseif script.Parent.Parent.PlayerStats.Playing.Value == false then
        cam.CoordinateFrame = CFrame.new(Vector3.new(head.Position.x, head.Position.y, head.Position.Z - 10),head.Position)
end
end

Anchor Script

while true do
    wait(9)
    script.Parent.Parent.Parent.Parent.Character.Torso.Anchored = false
    script.Parent.Parent.PlayerStats.Playing.Value = true
    wait(9)
    script.Parent.Parent.PlayerStats.Playing.Value = false
    script.Parent.Parent.Parent.Parent.Character.Torso.Anchored = true
end

Thanks :D

Answer this question