I have made an First Person viewmodel for my tools with help of this tutorial: “https://www.youtube.com/watch?v=tolnsCxgkpk&t=1s”
When an tool is equipped I put the custom made “ViewModel” made for that specific tool inside the game.Workspace.Camera locally and then I run this function
runService.RenderStepped:Connect(function()
if player.Character.Humanoid.Health <= 0 then
local viewModel = camera:FindFirstChild("ViewModel")
if viewModel then
viewModel:Destroy()
end
end
if equipped == true then
if camera:FindFirstChild("ViewModel") ~= nil then
camera.ViewModel:SetPrimaryPartCFrame(camera.CFrame)
for i,v in pairs(camera.ViewModel:GetChildren()) do
if v:IsA("BasePart") then
v.CanCollide = false
end
end
local mouseDelta = game:GetService("UserInputService"):GetMouseDelta() / 50
local swayX = math.clamp(mouseDelta.X, -0.3, 0.3)
local swayY = math.clamp(mouseDelta.Y, -0.3, 0.3)
swayCF = swayCF:Lerp(CFrame.new(swayX, swayY, 0), 0.3)
camera.ViewModel:SetPrimaryPartCFrame(camera.CFrame * swayCF)
end
end
end)
But when the viewModel is equipped it causes my character to kinda teleport just a small distance as you can see in this gyazo GIF “https://gyazo.com/c8688cb08eef4b5e5930ab87d795de01”.
This problem only happends when the player is fully zoomed in aswell. (But its an first person game so players will forced to be fully zoomed in)
All the parts are Collide = false, also Massless and so on. I have no clue whats causing the issue exactly.