AssemblyLinearVelocity Problem

I was making a combat system with velocity of course but problem is when activated, assemblylinearvelocity does not go in x and z coordinates. in y coordinates, it just floats repeatted. the fix on y is to use changestate freefall. but still did i do something wrong on the velocity?
I searched many of the post including :ApplyImpulse() but still didn’t work. they acted like same.
Serverscript

script.Parent.RemoteEvent.OnServerEvent:Connect(function(player, hit, value)
	local character = hit.Parent
	if hit.Name == "Handle" then
		character = hit.Parent.Parent
	end
	print(tostring(value))
	local humanoid = character:FindFirstChildWhichIsA("Humanoid")
	local primarypart = character:WaitForChild("HumanoidRootPart")
	local x = player.Character.PrimaryPart.CFrame.LookVector.X * value * 2
	local z = player.Character.PrimaryPart.CFrame.LookVector.Z * value * 2
	primarypart.AssemblyLinearVelocity = Vector3.new(x,value * 2,z)
	require(game.ReplicatedStorage.ModuleScript):RigPlayer(character)
	require(game.ReplicatedStorage.ModuleScript):Ragdoll(character)
	humanoid:ChangeState(Enum.HumanoidStateType.Physics)
	task.wait(1)
	humanoid:ChangeState(Enum.HumanoidStateType.Freefall)
	humanoid.Jump = true
end)

now it works on npcs but not on 2 players.

did you try temporarily setting the network owner of the character and its children to the server?

Yes, i did :SetNetworkOwner(nil)

try using physics instances like vector or linear velocity

I’ll try that thanks but i don’t know if the forces act same.

I think linear velocity is same.

What do you mean by physics instances like vector?

by that i meant the instance VectorForce if u want a constant velocity, that gradually accelerates unlike linear velocity, and u can use AngularVelocity for spinning forces

Thanks, i’m not on computer currently so i will look forward to that after i open my computer.

It doesn’t go because perhaps you’re not calculating the knockback direction quite correctly. If you want to get the X component, then you should use RightVector.
Not sure about this, but you probably shouldn’t change the HumanoidStateType from the server since the character assembly is in the player’s network ownership (just set PlatformStand to true for Humanoid). Also, you shouldn’t change the network owner to the server, as this will lag the player as well as use the ApplyImpulse method on it.

But the RightVector always go right. I want to go where the player is rotated so i use lookvector.
Also, you’re method is not worked on 2 players.

I was confused by the assignment and use of the X component of the vector in your code in this line.

local x = player.Character.PrimaryPart.CFrame.LookVector.X * value * 2

Since in LookVector it is always equal to 0. Why do you need it? Then just multiply LookVector by any number and that’s it…

Also, you’re method is not worked on 2 players.

What do you mean by this? Try replacing the AssemblyLinearVelocity change with LinearVelocity. This will give a constant force rather than an impulse.

Sorry for late reply, i will now answer your questions

the value is a strength multiplied by 2. i wanna go to the direction where the player is facing to.

I used the the LinearVelocity and tried again using RightVector, as i said the rightvelocity goes right. and the y just floats on 2 players. If you want a screen recording then i can provide.

edit: here is the code if you looking forward

script.Parent.RemoteEvent.OnServerEvent:Connect(function(player, hit, value)
	local character = hit.Parent
	if hit.Name == "Handle" then
		character = hit.Parent.Parent
	end
	local strength = player.PlayerGui.Scripts.Strength
	print(tostring(value))
	local humanoid = character:FindFirstChildWhichIsA("Humanoid")
	local primarypart = character:WaitForChild("HumanoidRootPart")
	local velocity = Instance.new("LinearVelocity")
	velocity.MaxForce = math.huge
	velocity.Parent = primarypart
	velocity.Attachment0 = primarypart.RootRigAttachment
	
	local x = player.Character.PrimaryPart.CFrame.RightVector.X * value * 2
	local z = player.Character.PrimaryPart.CFrame.RightVector.Z * value * 2
	velocity.VectorVelocity = Vector3.new(x,value * 2, z)
	require(game.ReplicatedStorage.ModuleScript):RigPlayer(character)
	require(game.ReplicatedStorage.ModuleScript):Ragdoll(character)
	humanoid:ChangeState(Enum.HumanoidStateType.Physics)
	game.Debris:AddItem(velocity, 1)
end)

Yes, please try providing a screen recording to better understand your issue.

I turned off my computer sorry, I now understand the lookvector and fixed it but
the problem is the y goes up forever like zero gravity i want it to go down