im trying to make a script that makes the cam see what the head precisely sees with the rotation, and that makes the limbs transparency to 0
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local cam = Workspace.CurrentCamera
local Players = game:GetService("Players")
local plr = Players.LocalPlayer
local chr = plr.Character or plr.CharacterAdded:Wait()
local head = chr:WaitForChild("Head")
local newPart = Instance.new("Part")
newPart.Name = "1PersonCam"
newPart.Parent = head
newPart.Size = Vector3.new(1, 1, 1)
newPart.CFrame = head.CFrame + Vector3.new(0, 0, -0.1)
newPart.Transparency = 1
newPart.CanCollide = false
local Weld = Instance.new("WeldConstraint")
Weld.Parent = newPart
Weld.Part0 = head
Weld.Part1 = newPart
local isInFirstPerson = false
RunService.RenderStepped:Connect(function()
local zoom = (cam.CFrame.Position - head.Position).Magnitude
if zoom < 1 then
if not isInFirstPerson then
isInFirstPerson = true
cam.CameraType = Enum.CameraType.Scriptable
end
cam.CFrame = newPart.CFrame
else
if isInFirstPerson then
isInFirstPerson = false
cam.CameraType = Enum.CameraType.Custom
end
end
end)
but when i do that, the cam goes crazy