Hello, I am currently making a game where a player can fire blocks from conveyors onto structures that others are standing on. These blocks will take out parts that the structure is made out of. I'm having trouble with it, however. I welded all of the parts of the building together and unanchored them. Then I made and tried the script below:
script.Parent.Touched:Connect(function(hit) if hit:IsA("BasePart") or hit:IsA("UnionOperation") then hit:BreakJoints() end end)
When I tried it, the welds and parts were only moved immediately after contact with the block, causing the block to bounce back. I want the block to pass clean through, so how do you think I can accomplish this? Any help would be appreciated. Thanks.
I found a solution, albeit a bit hacky. I made a wait() loop and made it so it updates a value that shows the velocity the block is at. When touched, the block gives the same velocity to the parts it touched. While it's not exactly a clear cut, it definitely knocks them down a lot better than before. Code:
local oldvelocity while wait() do oldvelocity = script.Parent.Velocity script.Parent.Touched:Connect(function(hit) if hit:IsA("BasePart") or hit:IsA("UnionOperation") then hit:BreakJoints() hit.Velocity = oldvelocity end end) end