When I clone an item, it unanchors it as well

Basically I’m trying to clone an item into workspace, and every time I do it the main part named “PrimaryPart”, to unanchored. Firstly it’s clearly anchored, when I clone it it is then unanchored and I cannot seem to find a way around it. Note: none of my scripts even mention anchored.

local placement = {}

function placement:startPlacement(item)
	local moving = true
	local PlayersService = game:GetService("Players")
	local WorkspaceService = game:GetService("Workspace")
	local Player = PlayersService.LocalPlayer
	local Mouse = Player:GetMouse()
	local Part = item:Clone()
	local Increment = 1
	Mouse.TargetFilter = item
	local function filter(number,increment)
	    number = math.floor(number)
		number = number-(number%increment)
		return number
	local function OnMove()
		if Mouse.Target and moving == true then
			Part.Parent = WorkspaceService
			Part.PrimaryPart.CFrame = CFrame.new(filter(Mouse.Hit.X,Increment),filter(Mouse.Hit.Y, Increment) + (Part.PrimaryPart.Size.Y/2),filter(Mouse.Hit.Z,Increment))
		moving = false

return placement


You could always try looping around the descendants of the Clone and then anchoring them 1 by 1 to see if that works as a possible temporary solution. Below is a possible version of a script (doesn’t take into account errors).

for i, v in pairs(Part) do
    if not v.Anchored then
        v.Anchored = not v.Anchored -- Sets to the opposite, personal pref.

Also, I noticed that every time you run the start placement function you’re re-assigning functions to both Mouse.Move and Mouse.Button1Down - after testing this in studio, I confirmed that if you attempt to re-assign without disconnecting (pretty sure that’s what it’s called) then that results in the two functions stacking rather than the second one overriding, meaning after 10 placements, on the 11th placement when you move the mouse, you’re launching the onMove function 11 times.

EDIT: Event:disconnect() is deprecated, going to look into what you actually need to do.

1 Like

The thing is, With all of the parts anchored the model doesnt move therefore, only the PrimaryPart will move. I left them unanchored for that reason, is there a way around that?

Is it possible you could make a place and recreate the issue so that I can fiddle around with it? Not too sure what you issue actually is.

1 Like

systemything.rbxl (38.0 KB)
Here ya go.

1 Like

For disconnecting functions, I’ve confirmed how to do so.

Set variable = function then you can do variable:disconnect() or variable:Disconnect() - unsure on which one is deprecated. Below holds an example

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

local connection

local function Clicked2()
	print("2nd Click")
local function Clicked()
	connection = mouse.Button1Down:connect(Clicked2)
connection = mouse.Button1Down:connect(Clicked)
1 Like

Your script isn’t working server-side and is replicating client-side only, nothing appears on the actual server. Perhaps this is related to the bug? (Haven’t looked at the actual scripts provided yet)

Studio has a button to switch between server and and client testing in between the play and stop buttons on the home tab.

I’m aware. Only experimenting with placement, the confirmation will be done server side when I get all of this sorted out. :slight_smile:

Every test I do, the primary part remains stationary? The only possible change I did was select the model (not the parts) then clicking anchor in the home tab that makes it so all descendants which can be anchored are anchored. (I’m standing still in the picture below, on top of the part)


Are you still experiencing the issue? If so, could you possibly record it or screenshot it in a visible manner (i.e. PrimaryPart selected).

Hmph, Every single test I’ve done and I anchored everything only the PrimaryPart was moving. I guess I shouldve tested, but I could’ve swore that this was an issue. Thanks! :slight_smile:

1 Like

No problemo! If any of the posts helped you figure out your solution, make sure to mark them as the solution so that others who wish to help you know that your problem is solved and others with the same problem know where to refer to for help.

If none of the posts helped arrive at the solution, then you can reply to your own post listing what you did it fix it and marking that as the solution, or make it clear in the title of the post that the issue is solved.