So, things start to twitch when I start dragging them and walking at the same time
How to fix this?
Code:
RunService.RenderStepped:Connect(function(dt)
if curPart then
local character = player.Character
if not character then return end
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if not humanoidRootPart then return end
local desiredPos
if UIS.TouchEnabled then
desiredPos = humanoidRootPart.Position + humanoidRootPart.CFrame.LookVector * carryDistance + Vector3.new(0, 1.5, 0)
else
local mouseRay = camera:ViewportPointToRay(UIS:GetMouseLocation().X, UIS:GetMouseLocation().Y)
desiredPos = mouseRay.Origin + mouseRay.Direction * carryDistance
end
local bv = curPart:FindFirstChild("HoldVelocity")
if bv then
bv.Velocity = (desiredPos - curPart.Position) * 15
end
local bg = curPart:FindFirstChild("HoldGyro")
if bg then
bg.CFrame = CFrame.new(curPart.Position) * CFrame.Angles(0, math.rad(45), 0)
end
return
end
end)