I’m trying to use this function to create knockback from a central point, but the affected players don’t seem to be moving. Here’s my script
local function applyKnockback(plr, origin)
local hrp: Part = plr.Character.HumanoidRootPart
hrp:SetNetworkOwner()
hrp:ApplyImpulseAtPosition(Vector3.new(math.huge, math.huge, math.huge), origin)
hrp:SetNetworkOwner(plr)
end
Testing it again, I found out you definitely need a delay of around 0.2 seconds for the force to apply.
and apply impulse should work just as fine.
local RE = script.Parent.RemoteEvent
RE.OnServerEvent:Connect(function(player, hitPlayer)
local attackerHRP = player.Character.HumanoidRootPart
local hitPlayerHRP : BasePart = hitPlayer.Character.HumanoidRootPart
local direction = hitPlayerHRP.Position - attackerHRP.Position
print("Server!")
local victimHumanoid = hitPlayer.Character.Humanoid
hitPlayerHRP:SetNetworkOwner(nil)
--victimHumanoid.PlatformStand = true
local trollFling = Vector3.new(-1,0,0)*50+Vector3.new(0,1,0)*25
--hitPlayerHRP.AssemblyLinearVelocity += trollFling
hitPlayerHRP:ApplyImpulseAtPosition(trollFling*50, hitPlayerHRP.CenterOfMass)
task.wait(0.2)
hitPlayerHRP:SetNetworkOwner(hitPlayer)
--victimHumanoid.PlatformStand = false
print("Can walk now")
end)
Also there seems to be a queue behavior if you apply impulse without setting network owner, the moment you set network owner all the apply impulse will stack and create a bigger one which is neat.
Tysm for the help! The delay was all I needed (Also I spent like 5 minutes pulling my hair out because math.huge breaks ApplyImpulseAtPosition apparently)