Setting AssemblyLinearVelocity and ApplyImpulse doesn't seem to work

I have a script meant to slow the fall of the player, I have tried setting the AssemblyLinearVelocity as well as using ApplyImpulse

The (current) code, a bit messy sorry. Also I'm aware the number is way too high, that's just for testing reasons.
part.Touched:Connect(function(hit)
	local Humanoid = hit.Parent:FindFirstChild("Humanoid")

	if Humanoid and not used then
		local Player = hit.Parent
		workspace.Gravity = 50
		Player.HumanoidRootPart.AssemblyLinearVelocity *= Vector3.new(1, 0, 1)
		Player.HumanoidRootPart.AssemblyLinearVelocity += Vector3.new(0, 500000, 0)
		--Player.Head:Destroy()
		print("test")
		used = true
	end
end)

(Yes I have set all of the variables that the code would need)
The rootpart seems to be referred to as I can use destroy to get rid of it, but either applying an impulse or changing the velocity doesn’t seem to cause any interaction whatsoever.
And yes the collision works, test prints.

1 Like

The issue is networkownership. You cannot apply velocity to player’s character parts, because Client owns them. If you try something like this in a local script, it will work.

Alternatively, if you want to do it in a server script, you can temporarily set the network ownership of humanoid rootpart to server.

if Humanoid and not used then
		local Player = hit.Parent
		workspace.Gravity = 50
        Player.HumanoidRootPart:SetNetworkOwnership(nil) --nil in network ownership is the server
		Player.HumanoidRootPart.AssemblyLinearVelocity *= Vector3.new(1, 0, 1)
		Player.HumanoidRootPart.AssemblyLinearVelocity += Vector3.new(0, 500000, 0)
		--Player.Head:Destroy()
		print("test")
		used = true
        task.wait(2)
        Player.HumanoidRootPart:SetNetworkOwnership(Player) --return the ownership to client, to not mess things up
	end
14 Likes

I had no idea that was a thing, setting the ownership seems to work, I might try localscripts later at some point.

Also I had to change it slightly because it was SetNetworkOwner and not SetNetworkOwnership

4 Likes