FirePoint is the part selected in the gif, at the tip of the gun. Visually, it is unmoving. However, whenever i try to fire, the bullet comes form a seemingly random direction. After researching the problem for a bit, I found this:
The gun in question is a rigged model that is attached to the camera (through RenderStepped). None of my other guns do this. Another demonstration of the seemingly broken and wrong position readouts:
I am beyond confused. I’m not sure what code is causing this, but heres the script that keeps the gun on the camera, incase it might be some help.
game:GetService("RunService").RenderStepped:Connect(function()
if game.Workspace.WeaponPreview:GetChildren()[1] then
local gun = game.Workspace.WeaponPreview:GetChildren()[1]
if char[gun.Name] then
if char[gun.Name]:FindFirstChild("Aiming") then
if not char[gun.Name].Aiming.Value then
pos = game.Workspace.CurrentCamera.CFrame*CFrame.new(char[gun.Name].Offset.Value) * CFrame.Angles(math.rad(char[gun.Name].PosRotation.Value.X),math.rad(char[gun.Name].PosRotation.Value.Y),math.rad(char[gun.Name].PosRotation.Value.Z))
gun:SetPrimaryPartCFrame(pos)
else
pos = game.Workspace.CurrentCamera.CFrame*CFrame.new(char[gun.Name].AimOffset.Value) * CFrame.Angles(math.rad(char[gun.Name].PosRotation.Value.X),math.rad(char[gun.Name].PosRotation.Value.Y),math.rad(char[gun.Name].PosRotation.Value.Z))
gun:SetPrimaryPartCFrame(pos)
end
else
--its a tool
pos = game.Workspace.CurrentCamera.CFrame*CFrame.new(char[gun.Name].Offset.Value) * CFrame.Angles(math.rad(char[gun.Name].PosRotation.Value.X),math.rad(char[gun.Name].PosRotation.Value.Y),math.rad(char[gun.Name].PosRotation.Value.Z))
gun:SetPrimaryPartCFrame(pos)
end
else
gun:Destroy()
end
end
end)