So i try to make a part that spawns when i click on a gui and then it rotates and moves. Everything is working but i wonder how i can do so it stops move and rotate at a specific position like when it have reached another parts position because its very hard to find the right place with the "For Loop"
My Code looks like this for the moment btw this script is inside PlayerGui.ScreenGui.TextButton
function onClicked() x = Instance.new("Part", game.Workspace) x.Size = Vector3.new(10,10,10) x.Position = Vector3.new(5,5,5) x.BrickColor = BrickColor.new("Bright blue") x.Transparency = "0.1" x.Anchored = true x.TopSurface = "Smooth" x.BottomSurface = "Smooth" for rm = 1,380 do x.CFrame = x.CFrame *CFrame.Angles(0.1,0.1,0.1) x.Position = x.Position +Vector3.new(0,0,0.1) wait() end x:remove() wait() end script.Parent.MouseButton1Click:connect(onClicked)
the most important to part to look at i think would be.
for rm = 1,380 do x.CFrame = x.CFrame *CFrame.Angles(0.1,0.1,0.1) x.Position = x.Position +Vector3.new(0,0,0.1) wait() end
Btw Sorry for my grammar and English
I quite don't understand what you want to accomplish here.. So you want it so that when the part is placed, it will stop, move, and rotate at a certain position but not a position that is taken?