My game is round based and some has some parts that are unanchored. When a new round starts, I anchor the unanchored parts, set their CFrame to their original locations, set their velocity to nothing, and then unanchor them.
The issue is that when I unanchor them, they start to fall again, as if it’s retaining the velocity that it had prior to me resetting it.
local part = game.Workspace.Part
local startCFrame = part.CFrame
part.Velocity = Vector3.new(0, 0, -20)
wait(0.5)
part.Anchored = true
part.CFrame = startCFrame
part.Velocity = Vector3.new()
part.Anchored = false
Is it possible the part falls due to gravity?
Try resetting the velocity after unanchoring the part.
you are unanchoring the part way to fast so it looks like it’s not being anchored at all.
add a wait before part.Anchored = false
In addition to resetting the velocity, you should also reset the angular velocity. I recreated your issue in studio and this solved the problem.
local part = game.Workspace.Part
local startCFrame = part.CFrame
part.Velocity = Vector3.new(0, 0, -20)
wait(0.5)
part.Anchored = true
part.CFrame = startCFrame
part.Velocity = Vector3.new()
part.AssemblyAngularVelocity = Vector3.new() --added this
part.Anchored = false
3 Likes
Thank you both, in the end setting the AssemblyAngularVelocity did the trick