Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to decrease lag when making fake hands?

Asked by 3 years ago

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

Log in to vote
1
Answered by
synkrio 281 Moderation Voter
3 years ago
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.

0
Might be a good idea to explain what you moved because it looks awfully similar incapaz 195 — 3y
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 synkrio 281 — 3y
0
ohhh i am face palming so hard thank you so much! botw_legend 502 — 3y
Ad

Answer this question