Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Body Velocity ceases to move model after model is modified?

Asked by
joeldes 201 Moderation Voter
5 years ago

I have a Model with a variety of parts welded together. Then in one of the parts, a BodyVelocity is pushing the model at a rate of 50 SPS.

Everything seems fine right?

Well, when I attempt to Delete one of those welded parts from the model the ENTIRE MODEL stops moving. I checked all the parts after deletion, none where accidentally anchored or anything. The appropriate parts where gone too. I checked the Body Mover and it still was set to try and push the parts to a velocity of 50.

Here is the part of the script that is removing parts.

UIS.InputBegan:Connect(function(inp, gp)
    if not gp then

        if inp.KeyCode == Enum.KeyCode.Space then
            local segments = game.Workspace.Model.Segments:GetChildren()

            if true then
                segments[#segments]:Destroy()
            end

        end


    end
end)

I searched Google but nothing I saw seem to be similar to my issue.

0
You should use a for-loop to iterate through the children to destroy them. The other thing is that you're using UIS so I assume this is a local script. Destroying things in a local script won't replicate for other players. xPolarium 1388 — 5y
0
for-loop is actually unnecessary after reading the desc again. xPolarium 1388 — 5y
0
Replication is not a priority for this project. I will try the for loop idea. Thx @xPolarium joeldes 201 — 5y

Answer this question