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

why does this only bounce the dummy in one direction?

local bp = Instance.new("BodyPosition", part)
	bp.MaxForce = Vector3.new(100000,100000,100000)
	bp.Position = part.Position * 1.375

GIF

1 answer

Hey Elixcore,

Looks like what you're trying to do is make a robloxian fling in a random direction. If I were you I personally wouldn't make it a BodyPosition, instead a BodyVelocity because finding random XYZ random coordinates on the game is hard to do with BodyPositions. then BodyVelocitys just push the part/object to where you want it to go.

Heres what I created to make the object fly in a random direction without making it go downwards.

	-- these math.random() variables create a random x y z	
	local x = math.random(-50, 50)	-- you have -x force and positive x force
	local y = math.random(45, 75)	-- 45 would be minimum up force and 75 would be max
	local z = math.random(-50, 50)	-- same thing as x but in the z cords
	
	local bv = Instance.new("BodyVelocity", part)
	bv.MaxForce = Vector3.new(100000, 100000, 100000)
	bv.Velocity = Vector3.new(x, y, z)
	
	wait(.3) -- Waits 0.3 seconds and destroys the bv to prevent it from flying forever
	bv:Destroy()

Hopefully this helps.

1 comment

0

thank you but this is not what im looking for, im looking for something like this. If the player is in front of you then fling him in front, if the opponent is in your left, fling him to the left, etc. etc. Also yes I have started using velocity. Forgot to edit this thread.

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