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
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() --It is a good habit to use Camel Case in variable names
for _, shard in pairs(shardClone:GetChildren()) do --Iterates over all of the shards
if shard:IsA("BasePart") then --Double check that shard is a part (in the case you have a script or something in the shards model)
shard.Position = Teapot.Position
end
end
end
you could also do
shard:ApplyImpulse(Vector3.new(0, 5, 0)) --Adjust amount as needed
to make the shards go up in the air after shattering