A model has all of its parts welded to its primary part.
When the player clicks on a valid position, a script gets that position then moves the primary part to that position.
As everything else is welded to the primary part, all the other parts in the model would also move to their new positions.
However, the model also needs to be anchored again as it was previously unanchored. Anchoring it immediately after positioning the model’s primary part means only the primary part of the model is in the correct position. While every other part has been anchored in the same position.
What are some solutions to this problem? I’ve tried using task.wait() and Heartbeat:Wait() but all of these examples still have a slight delay, meaning the model still falls partially through the floor.
Pseudocode of what I’m doing
OnServerEvent function(Model, TargetCFrame)
local ModelClone = Model:Clone()
ModelClone.Parent = workspace etc...
ModeClones Primary Part Position = TargetCFrame
-- This will immediately anchor all the parts, not good!
for parts in Model:GetChildren() do
parts.Anchored = true
end
end)
TL;DR
Anchoring the parts in a model seems to immediately do it. How can I wait until all parts are in the correct position then anchor it?