Hi, I’m currently just trying to make a part go unanchored once you clicked on it. And then waiting 5 seconds then it turns back to anchored and goes back to the original position. I have Part2 where it originally was.
local part = script.Parent.Parent
local part2 = game.Workspace.Part2
part.ClickDetector.MouseClick:Connect(function()
wait(1)
print("Has been clicked")
part.Anchored = not part.Anchored
print("Brick has fallen!")
wait(5)
print("We go back now")
part.Anchored = part.Anchored
print("Is now anchored")
part.CFrame.Position = part2.CFrame.Position
end)
After the part becomes anchored, it won’t go back to the position of Part2. It just says this in output: Position cannot be assigned to - Server - Script:14
local part = script.Parent.Parent
local part2 = game.Workspace.Part2
part.ClickDetector.MouseClick:Connect(function()
wait(1)
print("Has been clicked")
part.Anchored = not part.Anchored
print("Brick has fallen!")
wait(5)
print("We go back now")
part.Anchored = part.Anchored
print("Is now anchored")
part.Position = part2.Position
part.CFrame = CFrame.new(part.Position, part2.Position)
end)
Yes, but if I do just Position then it will just go back to the position, not the exact position though. If someone moved the part while it was falling, and the part flipped over or turned a bit, the part would go back as how it fell.
Part is the original part you click that falls, part2 is the second part that technically saves the position of the original part before it falls. And then it’s supposed to bring Part back to its original position.
You can get rid of part2 by saving part’s position like this:
local part = script.Parent.Parent
local cf = part.CFrame
part.ClickDetector.MouseClick:Connect(function()
wait(1)
print("Has been clicked")
part.Anchored = not part.Anchored
print("Brick has fallen!")
wait(5)
print("We go back now")
part.Anchored = true
print("Is now anchored")
part.CFrame = cf
end)