I'm working on a script for my game where when you click on a part it welds itself to you so you can carry it around. I'm (obviously) using a ClickDetector for this but it simply doesn't work. Nothing happens when the part is clicked. I'll assume it's a problem with the ClickDetector since Studio doesn't say there's anything wrong with the script. Anyways, there's probably something wrong with both. This is the LocalScript:
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local Torso = character.Torso
local Box = script.Parent.Parent
function onClicked(player)
print("Clicked by" player.Name)
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = Torso
Weld.Part1 = Box
Weld.C1 = CFrame.new (0,1,0)
Weld.Parent = Box
Box.Anchored = false
end)
script.Parent.MouseClick:Connect(onClicked)
When clicked it doesn't even print which makes me think there's something wrong with the detector.

2 comments
It's silly but you have an error in "print" xD
Lol