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)

4 comments
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??
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.
I tried that and it has not really changed anything. Any other possible ideas?
No idea... that's super strange.