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)
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
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.