Hi, i was wondering. How do you make it so that the BodyVelocity thing fires out the object in accordance to the Torso ??
Example, the brick is created. You create a BodyVelocity and assign the velocity. This does not work, and I thought it would:
local BodyVelocity = Instance.new("BodyVelocity") BodyVelocity.Parent = power local multiplier = 50 local pos = CFrame.new(0,0,-multiplier) * (torso.CFrame.lookVector * 1) BodyVelocity.velocity = pos
Credit to UserOnly16Characters for making me explain my code
Credit to Spongocardo for pointing out an error
When I tested that then it worked perfectly, in the correct tool setting of course.
The code I used(localscript in hopperbin in starterpack);
local plr = game.Players.LocalPlayer --Get the player --Make a function to add force to the object, relative to the torso function push(obj,torso) local BodyVelocity = Instance.new("BodyVelocity",obj) local multiplier = 50 --How much force to push them by --Mulitply the force on the negative Z axis(pushing back), from the torso's lookVector local pos = CFrame.new(0,0,-multiplier) * (torso.CFrame.lookVector * 1) --Apply the force BodyVelocity.velocity = pos end --When the hopperbin is selected, or if it was a tool the term would be 'Equipped' script.Parent.Selected:connect(function(mouse) --When they left click mouse.Button1Down:connect(function() --Get the part their mouse is on local brick = mouse.Target --Check if the brick is anchored or not if not brick.Anchored then --Call the function to add the BodyVelocity push(brick,plr.Character.Torso) end end) end)
And perhaps you could credit me next time you decide to post code of mine(: