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

How do I get the camera to follow the player during animations?

Asked by
Dad_Bot 34
6 years ago

I have an animation-heavy game that I am creating and it is supposed to be playable in both first and third person. The issue is that the default camera locks on to the humanoidrootpart, so in one of my animations when the character is jumping and diving, you can't even tell this is happening in first person. This is a script I made, yet it is really laggy and shaky. If anyone could help fix this script to be less shaky or give me an alternative, that would be great.

local player = game.Players.LocalPlayer
local char = player.Character
if not char or not char.Parent then
    char = player.CharacterAdded:wait()
end

print(player.Name)

wait(0.1)

if char then
    print("hi")
local pos1 = char.Head
local pos2 = char.HumanoidRootPart.Position
while true do
    wait()
    char.Humanoid.CameraOffset = Vector3.new(0, pos1.Position.Y - pos2.Y, 0)
    --print(pos1.Position)
    end
end

0
can I bump this? Dad_Bot 34 — 6y

Answer this question