What do you want to achieve? Keep it simple and clear!
There is a folder called “Unanchored” which is a direct child of Workspace. It has a bunch of parts in it. All the children of this folder are Unanchored and CanCollide true. I want to simply fling all the descendants of the folder in the x axis (toward the negative direction)
What is the issue? Include screenshots / videos if possible!
The script doesn’t work.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I searched the internet for how to use AssemblyLinearVelocity but don’t understand anything.
Edit: I changed the code to use ApplyImpulse instead, but it still doesn’t do anything.
local function TrainDebris()
for i, debris in pairs(game.Workspace.Unanchored:GetChildren()) do
debris:ApplyImpulse(Vector3.new(-30,0,0))
end
end
TrainDebris()
I should’ve specified better, but I want them to be flung and fall on the ground, as if they were unanchored parts that were tossed into the sky. But in this case, they’re being tossed to the side.
With a physics engine there isn’t a clear answer how far they should be moved, just that 30 units of force has been applied. Keep in mind force = mass * acceleration, so you may need a lot more force to have them flying across the place depending on the mass.
Use ``` to wrap your code blocks, they will be easier to read.
This:
```
local function TrainDebris()
print(“my code”)
end
```
How does your script fail? if there are errors please post them, otherwise go into detail about what “doesn’t work” means.
Did you try setting it to a much larger number? The first paragraph in my reply mentions how the distance traveled will be based on mass, a lighter object goes farther.
What is the mass of each part you are trying to toss? If they are heavy you will need to adjust your vector force accordingly since it relies on the mass of the part… maybe try a much higher number to test it out :
You might have to call it in local scripts if the parts are owned by the client side or set ownership to nil for the part. I realized I might be a little late