I made a script where it welds a part to Left Hand, but it keeps welding Left Hand to a Part how do I fix this? Here's my script but please refrain from saying "You're Dumb" instead of answering the question like the responses I normally get. Also I already tried flipping Part0 and Part1 and it didn't work, so are there other reason this could be occuring?
plr = game:GetService("Players").LocalPlayer char = plr.character rad = math.rad s = char:WaitForChild('WhiteBlack') sw = s.Handle wc = s.Handle.WeldConstraint local w = Instance.new('Weld', sw) lh = char:WaitForChild('LeftHand') function onKeyDown(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.Q then print("Q was pressed") w.Part0 = sw w.Part1 = lh sw.WeldConstraint.Enabled = false w.C0 = CFrame.new(0,0,0) * CFrame.Angles(rad(45),rad(0),rad(0)) end end game:GetService("UserInputService").InputBegan:connect(onKeyDown)
local plr = game.Players.LocalPlayer local char = plr.Character local s = char:WaitForChild("WhiteBlack") local sw = s:WaitForChild("Handle") local wc = sw:WaitForChild("WeldConstraint") local w = Instance.new("Weld", sw) local lh = char:WaitForChild("LeftHand") game:GetService("UserInputService").InputBegan:Connect(function(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.Q then print("Q was pressed") w.Part0 = sw w.Part1 = lh wc.Enabled = false w.C0 = CFrame.new(0,0,0) * CFrame.Angles(math.rad(45), math.rad(0), math.rad(0)) end end)
The issue is that when you define "char" you did not capitalize "character", even though the valid property of the player is Character
Also, its generally better to use the local variables than the global ones in scripts
You can also alter the C0 property original vector (CFrame.new(0, 0, 0)) to make sure the offset is clearly visible, when you weld the part the way you have, the part is simply placed in the location of the player's hand with a rotation.
Part1 is generally the root part (left hand in this case), which is not meant to auto-move
In order for the player to be able to move, the "handle" should be unanchored.