I’m trying to make a random chest spawner, I’ve already made the script for it to randomly spawn, and get deleted after a certain time, but since my terrain is not flat I have to make it spawn high up in the air and then make it fall by not anchoring it. But that results in all parts inside the chest model falls apart. Is there anyway I can fix this?
You can use the model’s PrimaryPart and use MoveTo() to move the chest. It will move it the same way position does, meaning it will attempt to place it at the given position and move it upward until it’s no longer colliding with anything.
Weld the chest parts to one another, so they stick together without having to anchor them. (Welds connects parts to each other, and will move together without colliding into each other)
And set a PrimaryPart to the model’s properties so you can use that PrimaryPart to move, position, rotate, etc using scripts.
See more here: Weld | Roblox Creator Documentation - WeldConstraint | Roblox Creator Documentation
I tried doing it with moveTo() now but it just changes the chest’s position normally as vector3 dpes, if it’s underground it doesn’t go upwards until it doesn’t collide with anything anymore.
Are you sure you’re using it correctly? It says on the page itself that it does that.
“If there are any obstructions where the model is to be moved to, such as Terrain or other BaseParts, then the model will be moved up in the Y direction until there is nothing in the way. If this behavior is not desired, Model:SetPrimaryPartCFrame should be used instead.”
When you use MoveTo is the chest still Anchored?