How to boost a player backwards?

Hello! I am trying to boost players backwards when they touch me, the problem is it turns the velocity into 0,0,0 even though when print the same thing of my own humanoid it prints fine!
why does my code return velocity as 0,0,0?

	if hit.Parent:FindFirstChild("Humanoid") and hit.Parent ~= script.Parent.Parent and hit.Parent.HumanoidRootPart:findFirstChild("BOOSTAWAY") == nil then
		print("BOOSTING AWAY")
		hit.Parent:FindFirstChild("Humanoid").Sit = true
		local boost ="BodyVelocity",hit.Parent.HumanoidRootPart)
		boost.Name = "BOOSTAWAY"
		local fling = +,2,0)) *,100,100))
		boost.Velocity = fling
1 Like

Sorry, by velocity do you mean this statement?

Also, I think you should be wary that the wait statement here won’t work because of how .Touched events work as they can trigger multiple times.

To prevent the Touched event from triggering multiple times we can use a debounce as follows like in this article. It even has an example for button pressed which shows the error with putting just wait (0.5) in a touched statement. This might be what is causing the problem as well.

yes the

local fling = +,2,0)) *,100,100))

also if u read above it checks and makes sure it doesnt already have a booster in it!

Hmm, well then why are you creating a new vector 3 for an already created vector 3?

I believe because of this invalid parameter it is creating an empty vector 3 value instead of what you want.

Try this which removes the unnecessary from: +,2,0)) 

To this, also try splittting it up into variables. It’s really hard to read that really long line.

local humanoidLookVector = hit.Parent.HumanoidRootPart.CFrame.LookVector
local magnitude = 100
local fling = (humanoidLookVector +,2,0) ) * magnitude

Works! i deleted the magnitude part and did,100,-100) and it works! Thank you!