While a Rig is walking, playing tween on HumRootPart looks like it teleports

The tween works when the character is close enough to the player but it seems to teleport on the client side? There is no such problem on the server side.

how can i fix this problem? Character tween needs to work on the server side too, I can’t just do it for the client side, it has to work on the server side as well to trigger Touched events! (I don’t want to detect Touched events on client side, because exploiters…)

gif: https://gyazo.com/f15289e01a17eb9cf21cc4796b10f78f
code: (Script parent is Rig)

local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

local Character = script.Parent
local Humanoid = Character.Humanoid
local HumRootPart = Character.HumanoidRootPart

local function findTarget()
	local players = Players:GetPlayers()
	local maxDistance = math.huge
	local nearestTarget

	for _,Player in pairs(players) do
		if Player.Character then
			local target = Player.Character
			local Hum = target:FindFirstChild("Humanoid")
			if not Hum or Hum.Health == 0 then continue end

			local distance = (HumRootPart.Position - target.HumanoidRootPart.Position).Magnitude

			if distance < maxDistance then
				nearestTarget = target
				maxDistance = distance

	return nearestTarget

local Tween
local _WalkSpeed = 8
local function attack(target)
	-- Zıplarsa diye önlem!
	local Pos1 = Vector3.new(HumRootPart.Position.X,0,HumRootPart.Position.Z)
	local Pos2 = Vector3.new(target.HumanoidRootPart.Position.X,0,target.HumanoidRootPart.Position.Z)
	local distance = (Pos1 - Pos2).Magnitude
	local debounce = false

	if distance > 5 then
		if Tween then Tween:Pause() end
		Humanoid.WalkSpeed = _WalkSpeed
		Humanoid.WalkSpeed = 0
		local oldCF = HumRootPart.CFrame
		local newCF = CFrame.lookAt(HumRootPart.Position, target.HumanoidRootPart.Position * Vector3.new(1, 0, 1) + HumRootPart.Position * Vector3.new(0, 1, 0))
		local x1, y1, z1 = oldCF:ToEulerAnglesYXZ()
		local x2, y2, z2 = newCF:ToEulerAnglesYXZ()
		local x,y,z = x2-x1,y2-y1,z2-z1
		local Goal = oldCF * CFrame.Angles(x,y,z)
		Tween = TweenService:Create(HumRootPart, TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{CFrame = Goal})
local function Loop()
	local target = findTarget()
	if target then


if you want test it:
Tweening_Rig.rbxl (81.5 KB)

I think the last number in your TweenInfo is the time it takes for the tween to happen. By default it’s 1.

i don’t understand what you are saying, it has number 1 at first, not last


Humanoid:SetNetworkOwner(nil) //nil defaults to server

already NetworkOwner is nil because I test it in roblox studio

What do you mean?


It’s best, whenever possible, to handle player’s movement on the client only. Player movement in Roblox, and in most games, is entirely handled on the client and replicates to the server automatically. If you tween the character on that player’s client, it will be replicated. Keep in mind you cannot move a player’s character from another player’s client, it must be the client of the player you want to move. You can use remote events to pass that information to whichever client needs it.

Edit; this is precisely why the client is having strange behavior but the server looks good, the players client is generating their movement, sending to the server (with some slight delay, especially if their ping is bad), then your script is tweening them at that point which is fighting with their delayed position and their actual position on client. The position that the server thinks the player at is not perfect since connection times are rarely, if ever, 0 ping.

Because it’s 1 that’s how long the tween takes. You said it appeared to be teleporting so I thought the 1 second time length would be so quick it might appear to be a teleport. What happens if you increase the time to 5 just to see if that’s part of the issue.

1 Like

I think you misunderstood me, I’m not changing a player’s position, I’m changing the npc’s rotation.

nothing has changed, and it has nothing to do with it, 1 second is not that short