Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how to decrease lag when making fake hands?

so i am making fake hands for my fps game this is the code:

game:GetService("RunService").RenderStepped:Connect(function()
	mytool = character:FindFirstChildOfClass("Tool")
	if mytool then
		righthand:SetPrimaryPartCFrame(mytool.tool.righthand.CFrame)
		lefthand:SetPrimaryPartCFrame(mytool.tool.lefthand.CFrame)
		mytool.tool:SetPrimaryPartCFrame(camera.CFrame)
		game.ReplicatedStorage.look:FireServer(camera.CFrame.LookVector.Y)
	end
end

so in line 6 it moves the gun it works well 0 lag moves when i move but right before it one line 5 and 4 it moves the hands but the hands are laggy and when i move they move late so they go to right where they should have been 1 frame ago how do i fix this?

1 answer

✓ Accepted answer
game:GetService("RunService").RenderStepped:Connect(function()
    mytool = character:FindFirstChildOfClass("Tool")
    if mytool then
        mytool.tool:SetPrimaryPartCFrame(camera.CFrame)
        righthand:SetPrimaryPartCFrame(mytool.tool.righthand.CFrame)
        lefthand:SetPrimaryPartCFrame(mytool.tool.lefthand.CFrame)
        game.ReplicatedStorage.look:FireServer(camera.CFrame.LookVector.Y)
    end
end

Just move the arms after the entire model has been moved.

3 comments

0

Might be a good idea to explain what you moved because it looks awfully similar

0

The code that he posted moved the arms to where the model was last frame. This code moves the arms to the current frame

0

ohhh i am face palming so hard thank you so much!

This discussion is preserved as it was. New answers, comments, and votes are closed.