hey.
i’m wondering what the best way to fling a part is. i dont wanna use body velocity but if i have to, i can.
basically, if a part spawns, and other parts are touching it, whats the best way to fling them out of the part? ex. like an explosion.
yea… but doesn’t assemblylinearvelocity go in only 1 direction? i need it to be flung away from the part, no matter its position relative to the part, as long as it’s touching. plus, collisions on the part are false.
assemblylinearvelocity is a vector3, which means it accepts 3 values for the x, y, and z axis. heres a very simple script for flinging a part away from a part its touching
local velocity = 100 -- how much you want to fling it
local part = script.Parent -- or whatever the parts path is
part.Touched:Connect(function(hit)
local launchDirection = CFrame.lookAt(hit.Position, part.Position).LookVector
-- creates a cframe that looks at the part starting from the hit and gets the lookvector. i think theres a simpler way of getting the launch direction this but i forgot
part.AssemblyLinearVelocity = launchDirection * velocity -- flings it to the launch direction
end)