Copy tool like behavior

I’m making a clone tool, and I need it so that when you clone a part if there are any parts above it, then
the cloned part will be moved to the top. That’s all thank you.

1 Like

I know :MoveTo usually uses collisions, so that this exact thing happens. If not that you could try casting a ray and if it returns a part you add the y vector by the part’s y axis

I already tried :MoveTo, Also I have no idea how to use rays.

edit: I tried using rays, rays stop when it hits one part.

This is default behavior when using :MoveTo() or setting .Position.

  1. Clone your part.
  2. Parent it to workspace or wherever you’re parenting it to within the workspace.
  3. Set the part’s Position property to the original part’s position. This will automatically position the part according to nearby intersecting parts.

I tried that and it didn’t work.

Please provide your code and any errors you are receiving from that code.

There are no errors, the part just collides with the other parts.

Again, please provide relevant code.

This is the server side of my clone tool

local Tool = script.Parent
local Action = Tool:WaitForChild(“Action”)
local Debris = game:GetService(“Debris”)

Action.OnServerEvent:Connect(function(Player, Action, Part, ToCF)
if Action == “SetCF” and Part then
if not Part.Locked then
local Tag = Part:FindFirstChild(“Tag”)
if not Tag then
SetCF(Player, Part, ToCF)
end
if Tag then
if Tag.Value then
if Tag.Value == Player then
SetCF(Player, Part, ToCF)
end
end
end
end
end
if Action == “Claim” and Part then
local Tag = Part:FindFirstChild(“Tag”)
if not Tag and not Part.Locked then
Tag = Instance.new(“ObjectValue”)
Tag.Name = “Tag”
Tag.Value = Player
Tag.Parent = Part
end
end
end)

function SetCF(Player, Part, ToCF)
Part:BreakJoints()
Part.CFrame = ToCF
Part:MakeJoints()
MouseUp(Player, Part)
end

function MouseUp(Player, Part)
local Tag = Part:FindFirstChild(“Tag”)
if Tag.Value then
if Tag.Value == Player then
Tag:Destroy()
end
end
end

when positioning a model to whatever part you want using moveto you simply just do this;

partModel:MoveTo(part.Position)

Yes, but I’m moving individual parts.

then you would just set the parts Position using a Vector3

part1.Position = part2.Position

simple as that.

  1. Please format your code using the “Preformatted text” button

  2. You’re clearly not using .Position, and if you “tried that” you clearly did it incorrectly, and haven’t provided code of where you tried the .Position method.

1 Like