Fake Hands are laggy

Hello. I made Fake Hands (just like in Arsenal, etc), but for some reason, they look quite laggy when jumping or facing certain direction.
Here is a video which shows what happens:
https://streamable.com/dylxge
Here is my script:

local runService = game:GetService("RunService");

local arms = script.Arms;

local clone = arms:Clone();

clone.Parent = workspace

clone.PrimaryPart = clone.Primary

local userInputService = game:GetService("UserInputService");

userInputService.MouseIconEnabled = false

local function set_Hands()
	local currentCFrame = workspace.CurrentCamera.CFrame;
	
	clone:SetPrimaryPartCFrame(CFrame.new(currentCFrame.Position + currentCFrame.LookVector * 1.4, game.Players.LocalPlayer:GetMouse().Hit.p))
end;

runService.RenderStepped:Connect(set_Hands)

Any help?

1 Like

I think it is because of the problems with :SetPrimaryPartCFrame() and maybe because you’re doing some unnecessary calculations. A simpler way of doing it is to set the viewmodel’s that’s the most used name for “fake hands” to the camera’s CFrame + an offset.
For that, you’re gonna have to manually adjust that offset.

local runService = game:GetService("RunService");
local userInputService = game:GetService("UserInputService");
local currentCam = workspace.CurrentCamera

local arms = script:WaitForChild("Arms"); -- just in case
local clone = arms:Clone();

local offset = CFrame.new(0,0,0) -- mess around with those values

clone.Parent = currentCam -- i think it's a more suitable place for it
userInputService.MouseIconEnabled = false

local function updateCFrame() -- fancy name
	
	clone.PrimaryPart.CFrame = currentCam.CFrame * offset
	
end;

runService.RenderStepped:Connect(updateCFrame)

Another problem might be that your parts have CanCollide or Anchored set to true.
Also, make sure to weld all parts to the PrimaryPart.

2 Likes

Thank you both @BlearDev and @BlearDev.
Very helpful :+1: :pray:

1 Like