im trying to make a helmet that is at player camera cframe but when the field of view changes the helmet distance from the camera is wrong
the problem: Blox Company - Roblox Studio (gyazo.com)
my script:
local lasto = os.clock()
RunService.RenderStepped:Connect(function()
if workspace.CurrentCamera then
local FOV = camera.FieldOfView
if FOV <= 70 then
FOV = 0
end
if os.clock() - lasto >= 0.3 then
print(FOV)
lasto = os.clock()
end
Cap:PivotTo(camera:GetRenderCFrame())
end
end)
local RunService = game:GetService("RunService")
local workspace = game:GetService("Workspace")
-- Assuming 'camera' and 'Cap' are defined somewhere in your code
local camera = workspace.CurrentCamera
local Cap = -- Define Cap here
local lasto = os.clock()
RunService.RenderStepped:Connect(function()
if camera then
local FOV = camera.FieldOfView
if FOV <= 70 then
FOV = 0
end
if os.clock() - lasto >= 0.3 then
print(FOV)
lasto = os.clock()
end
Cap.PivotTo(camera.CFrame)
end
end)
you just sent me the same code i had with different words lol