Tween is very jittery

so the tween im making is very jittery bruh

here is my script

function common:_M1()
	
	local p = self.args[1]
	local weapon = self.args[2]
	
	local count = self.args[3]
	local blade = weapon.Blade
	local caster = c.new(blade)
	
	local rcp = RaycastParams.new()
	rcp.FilterType = Enum.RaycastFilterType.Blacklist
	rcp.FilterDescendantsInstances = {p, weapon}
	caster.Visualizer = true
	
	caster.RaycastParams = rcp
	caster:HitStart()
	
	self.will_enemy_collide = RaycastParams.new()
	self.will_enemy_collide.FilterType = Enum.RaycastFilterType.Whitelist
	self.will_enemy_collide.FilterDescendantsInstances = {game.Workspace.Part}
	
	caster.OnHit:Connect(function(GOT_HIT)
		
		local enemy = GOT_HIT.Parent
		print(enemy.Name)
		
		if enemy:GetAttribute("Times_Hit") and enemy then
			
			times_hit += 1
			local ROOT = enemy.HumanoidRootPart

			local damageTaker = enemy.Humanoid 
			local attribute = enemy:GetAttribute("Times_Hit")

			if tick() - times_since_last_hit >= time_thresh_COMBO_RESET then
				times_hit = 0
				enemy:SetAttribute("Times_hit", times_hit)
			end

			times_since_last_hit = tick()
			enemy:SetAttribute("Times_Hit", times_hit)
			
			local will_hit = workspace:Raycast(ROOT.Position, ROOT.CFrame.LookVector * -100, self.will_enemy_collide)
			
			if enemy:GetAttribute("Times_Hit") < 3 then
				local f = 900
				ROOT:ApplyImpulse(p.HumanoidRootPart.CFrame.LookVector * f)
			end
			
			if enemy:GetAttribute("Times_Hit") == 3 and will_hit then 
				
				local position = will_hit.Position 
				local distance = will_hit.Distance
				
				local new = Vector3.new(position.X, position.Y + 17, position.Z)
				
				local tweenService = game:GetService("TweenService")
				local info = TweenInfo.new(.7, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0)
				local goal = {Position = new}
				
				local tween = tweenService:Create(ROOT, info, goal)
				tween:Play()
				
				tween.Completed:Connect(function()
					print("Succesfully completed :)")
				end)
				
			end
		end
	end)
	
	task.wait(self.args[4])
	caster:HitStop()
	
end

pls scroll down to the end to see what tween im making with what values
for some reason the tween is jittery

i switched to lerp which seems to have fixed the problem but im just curious why this tween was jittery

I can’t possibly think how you see the tween as jittery when it takes 0.7 seconds to complete. Maybe it’s because the tween happens on the server and the server has others things to worry about, thus becoming “jittery”.

1 Like

this is probably because you’re tweening the character position on the server. tweening the position along with physics doesn’t work well . you can restrict the velocity of the enemy and tween the position to mitigate the jitter

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.