Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Moving a part to inside another part?

Asked by 9 years ago

I have a part that I want to place into another part but whenever I change the part's position, it just moves ontop of it.

local part1 = game.Workspace.Part
local part2 = game.Workspace.Part2

function MovePart()
part1.Position = part2.Position -- The part just moves ontop of it :(
end

MovePart()

Help please! :(

1 answer

Log in to vote
1
Answered by
4Bros 550 Moderation Voter
9 years ago

Hey again :)

Alright so when you are using properties such as size and position, they will not let parts intersect each other if their property CanCollide is set to true. If you change CanCollide to false, you can make them intersect, however if you want the part to stay CanCollided then you will need to use CFrame.

local part1 = game.Workspace.Part
local part2 = game.Workspace.Part2

function MovePart()
part1.CFrame = part2.CFrame
end


MovePart()

1
Omg thank you so much! regentia 55 — 9y
1
no problem :) 4Bros 550 — 9y
Ad

Answer this question