Tool immediately flies off map

local button = script.Parent
local gui = script.Parent.Parent.Parent:WaitForChild("BuildingGui")
local rS = game:GetService("ReplicatedStorage")
local char = game:GetService("Players").LocalPlayer.Character
local debounce = false

button.MouseButton1Up:Connect(function()
	if not debounce then
		debounce = true
		if not gui.Enabled then
			--- if gui is closed, create the tool and weld it to the character's hadn
			gui.Enabled = not gui.Enabled
			local pda = rS.Items:WaitForChild("PDA"):Clone()
			pda.Parent = char
			local weld = Instance.new("WeldConstraint")
			weld.Parent = char:FindFirstChild("LeftHand")
			weld.Part0 = char:FindFirstChild("LeftHand")
			
			local pda = rS.Items:WaitForChild("PDA"):Clone()
			weld.Part1 = pda.Handle
			pda.Parent = char
			pda:SetPrimaryPartCFrame(char.LeftHand.CFrame)
			print(pda.PrimaryPart.CFrame)
			print(char.LeftHand.CFrame)
			wait(0.5)
			debounce = false
		else
			--- if the gui is already open, destroy the tool and weld
			gui.Enabled = false
			local pda = char:FindFirstChild("PDA")
			if pda then
				pda:Destroy()
			end
			local weld = char.LeftHand:FindFirstChild("WeldConstraint")
			if weld then
				weld:Destroy()
			end
		end
	end
end)

Whenever I try to create the tool, it immediately flings itself, despite both cancolllide and anchored being turned off.

I get pushed around when it is spawned, which I assume is it flying away. Also, the tool isn’t deleted from falling into the void. I’m not anchoring the tool because I weld it to the character and I don’t want the character to be stuck. It does get welded to the hand, but not before it is flung away.
pda
Somehow, before the tool is welded to the hand, it is flung.

Is there a bodymover in the tool?
Does the tool have a handle?
Is the tools handle collide false?

You need to elaborate more.

  1. No.
  2. It’s not technically a tool, but it does have a handle that is welded to the rest of the tool and the hand of the character.
  3. Both the mesh and handle in the tool have CanCollide turned off.

Can I see what is created in explorer?

Baseplate.rbxl (47.6 KB)

Found the problem. You forgot to weld the handle to the main part.

Please elaborate. There is a weld in between the handle and the mesh.

I see, the problem is that its welding to the character incorrectly.

The issue with your code is that it is welded to the hand. But its not attached in the right place.

Basically, the object is Spawning but not at your left hand position. Its spawning in the origin, which means that the weld is relative to your current position and the position it was when it has been cloned. To fix this, position the item in the correct location relative to your hand before welding the item.

Great. Now I just have to fix the rotation.

1 Like

Also remember that this can be done more efficiently by changing the model into an accessory or a tool.