Help Needed for destroyed parts position

Hey! I’m writing to ask for some scripting support

I’m trying to figure out how to get a parts position when it touches the ground it spawns in shards and for some reason I can’t figure out how to spawn the shards to the position to where the part fell

I can’t change the position of the clone in workspace

image



then after the part falls it gets destroyed and its just the shattered glass

1 Like

hello
the reason you cant change the position of the shards in the workspace is because the shards are a model, which need to be moved with the :PivotTo() function.

if you are want something simple, you can just get the position of the teapot (Teapot.Position) and then iterate over the teapot shards in a for loop.
you can
so something like:

local function shatterTeapot()
    local shardClone = shards:Clone()

    for _, shard in pairs(shardClone:GetChildren()) do
        if shard:IsA("BasePart") then
            shard.Position = Teapot.Position
        end
    end
end

you could also do

shard:ApplyImpulse(Vector3.new(0, 5, 0)) -- Make higher to make impulse stronger

to make the shards go up in the air after shattering

Thank you so much for that, I’ve tested it and now it works like it’s supposed too

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.