Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is my move tool separating the bricks in a model?

I have a move tool I created where I can move drag around bricks that are in a model. It works okay if I click and hold and drag the objects around. However, if I just click once on a part of the brick that is in a model, that brick gets moved and the other one does not...any ideas?

Here is my code

 local player = game.Players.LocalPlayer
 local mouse = player:GetMouse()
 local moveEvent = nil --We need to store the event so we may disconnect when left-click is released

mouse.Button1Down:connect(function()
	local target = mouse.Target
	if target and target.Parent.Name == "Furniture" then
        	target.Parent.PrimaryPart = target
        	mouse.TargetFilter = target
            	moveEvent = mouse.Move:connect(function()
                	if (player.Character.UpperTorso.Position - mouse.TargetFilter.Position).magnitude <= 35 then
                		target.Parent:SetPrimaryPartCFrame(CFrame.new((mouse.Hit.p)))	 
                	else  
                		moveEvent:disconnect()
                	end                   
              end)
       end
 end)

1 answer

Hm, your script looks fine.

What you can try doing is not setting the model's PrimaryPart to the mouse's target before hand, and just use a preset primary part, although this shouldn't make a difference. If you don't want your model to be anchored, try welding all the parts together with a weld script such as Quenty's qPerfectionWeld, or else make sure they're all anchored.

4 comments

0

How would I use a preset primary part? How would I put that in my script? Do I put a stringvalue inside the model with the name of the primarypart? The script would still have to wait for me to click on the brick??

0

All you have to do is click the model, click the field where it says "Primary Part", and set the primary part to a part inside the model - Preferably the one closest to the center or biggest.

0

I tried that and it has not really changed anything. Any other possible ideas?

0

No idea... that's super strange.

This discussion is preserved as it was. New answers, comments, and votes are closed.