I've been trying to remake those early Roblox construction games. I know that the old construction tools only work with Experimental Mode, so I made mines from scratch. Unfortunately, there is a problem when you release your mouse. Sometimes it the brick creates the joints but it teleports up and disconnects some other bricks. I don't know how to explain it without pictures.
Here is a snippet of the client script:
local function mouseDown() local target = mouse.Target if canSelect(target) then -- checks if the target exists and if the target isn't locked or too far away local point = mouse.hit:toObjectSpace(target.CFrame).p if trySelection(target) then -- sets the selection to the model the part is in local objects = {} collectBaseParts(currentSelection, objects) -- gets the selection + the target if it is a base part --table.foreachi(objects, print) -- debugging local s, msg = pcall(function() dragger = Instance.new('Dragger') dragger:MouseDown(target, point, objects) mouse.Icon = 'rbxasset://textures/grabrotatecursor.png' --tool.Enabled = false end) if not s then warn(msg) end end end end local function mouseUp() --tool.Enabled = true mouse.Icon = 'rbxasset://textures/grabcursor.png' pcall(function() dragger:MouseUp() selection.Adornee = nil lasso.Part = nil dragger = nil end) if currentSelection and workspace.FilteringEnabled then -- checks if the selection exists and if there is filtering enabled if currentSelection:IsA('BasePart') then -- tells the server to place the part in the desired location tool:WaitForChild('PlaceParts'):InvokeServer(currentSelection, currentSelection.CFrame) elseif currentSelection:IsA('Model') then -- tells the server to place all the parts in the model in the desired locations for i, obj in ipairs(currentSelection:GetDescendants()) do if obj:IsA('BasePart') then tool:WaitForChild('PlaceParts'):InvokeServer(obj, obj.CFrame) end end end end -- if no filtering enabled it doesn't send the server the message because the server already got it currentSelection = nil end
Here is the server script:
tool = script.Parent tool.PlaceParts.OnServerInvoke = function(player, part, cframe) pcall(function() part.CFrame = cframe end) end
Is this a problem with the dragger tool, or a problem with the code?