I am attempting to create a spectate system of a user’s first-person view but when I spectate a user who is starting left/right in the air their character jitters and shakes the camera for the person spectating.
GIF of what is happening: https://gyazo.com/713b245da914114387bbb6638d60ade7
I am testing this on a blank baseplate with only one script which is below
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Camera = workspace.CurrentCamera
local SpectatingPlayer
UserInputService.InputBegan:Connect(function(Key, GameProcessed)
if GameProcessed then
return
end
if Key.KeyCode == Enum.KeyCode.F then
if not SpectatingPlayer then
for i,v in pairs(game.Players:GetChildren()) do
if v ~= Player then
SpectatingPlayer = v
end
end
Camera.CameraType = Enum.CameraType.Scriptable
else
Camera.CameraType = Enum.CameraType.Fixed
end
end
end)
game:GetService("RunService").RenderStepped:Connect(function()
if not SpectatingPlayer then
return
end
Camera.CFrame = SpectatingPlayer.Character.HumanoidRootPart.CFrame
end)