Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make players pushed back (fling a little)?

I saw people using forces to push/fling, so I tried this.

local y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.Velocity = humanoid.Parent.HumanoidRootPart.CFrame.lookVector *  -9000
y.Parent = humanoid.Parent.HumanoidRootPart
game.Debris:AddItem(y,1)

So what i'm doing is putting a body force in humanoid root part, and this only happens if they touch a tornado (spell) for each person. I tried making the value as high/low as I could and nothing happens. So what actually happens is that they take damage from my tornado, but they don't get flinged. How do I make them get pushed back/flinged? I'm confused and please help thx. Note: The humanoid is from the touched function: .Touched:Connect(function(part), part.Parent:FindFirstChild("Humanoid").

2 answers

✓ Accepted answer

BodyForces are deprecated. I'd recommend using the new movers, which can be found in the same tab as constraints. Only limitation is that they require an Attachment, so using this code should work:

function AddForceToPlayer(Force,Player)
	local Attach = Instance.new("Attachment")
	Attach.Parent = Player.Character.HumanoidRootPart

	local Force = Instance.new("VectorForce")
	Force.Parent = Player.Character.HumanoidRootPart

	Force.Force = Force--a mouthful, but this makes the vectorforce's force equal to the vector3 that you pass as an argument
end

10 comments

0

wheres the power?

0

btw when the tornado hit the players they just stand still so...

0

You need just one power. Just make the Vector3 you put in as the first argument larger.

0

oh i put Force instead of a number lol

0

um... I put a number like 10000 and they dont move...

0

oh wait vector3

0

they still dont move when i put Vector3.new(10000,10000,10000) on the = Force part

0

My bad. Please add this line: Force.Attachment0 = Attach

0

OMG THANK YOU SO MUCH IT WORKS!!!!

0

nvm, I just make the humanoids raise a little so the force works.

heres what else I tried but doesn't make the dummies move at all:

main.tornado.Cone.Touched:Connect(function(part)
		
		
		
		local humanoid = part.Parent:FindFirstChild("Humanoid")
		
		if humanoid then
			if humanoid == player.Character.Humanoid then
				
			else
				
					print("damage worked")
				print((4*multiplier))
				local Attach = Instance.new("Attachment")
				Attach.Parent = humanoid.Parent.HumanoidRootPart
				
				local Force = Instance.new("VectorForce")
				Force.Parent = humanoid.Parent.HumanoidRootPart
				
				Force.Force = Vector3.new(100000,100000,100000)
					humanoid:TakeDamage((4*multiplier))
			
			end
		end		
	end)

This discussion is preserved as it was. New answers, comments, and votes are closed.