So I have this script that would weld this union to the player, but it does not weld and just falls threw the world, any help?
script.Parent.MouseButton1Click:Connect(function()
local player = script.Parent.Parent.Parent.Parent
local character = player.Character
if character:FindFirstChild("Humanoid") ~= nil then -- Accessory script
local p = script:WaitForChild("Union"):Clone()
p.Parent = character
p.Name = "Toothbrush"
p.Transparency = 0.5
p.Position = character:FindFirstChild("LeftHand").Position
local dog = Instance.new("WeldConstraint")
dog.Part0 = p
dog.Part1 = character.LeftHand
print("It should work")
wait(.1)
end
end)
I might wanna make it more clear then. For example, say “WeldConstraint” in the title, rather than “Weld”.
I’m a bit confused by the picture. Did you click the button multiple times to get that much toothbrushes? My suggestion if they keep spawning different places is before you add the WeldConstraint, specify not only the position, but the rotation of it. For example:
script.Parent.MouseButton1Click:Connect(function()
local player = script.Parent.Parent.Parent.Parent
local character = player.Character
if character:FindFirstChild("Humanoid") ~= nil then -- Accessory script
local p = script:WaitForChild("Union"):Clone()
p.Parent = character
p.Name = "Toothbrush"
p.Transparency = 0.5
p.CFrame= CFrame.new(character:FindFirstChild("LeftHand").Position) * CFrame.Angles(0,0,0) -- Change to your wanted angles.
local dog = Instance.new("WeldConstraint")
dog.Part0 = p
dog.Part1 = character.LeftHand
print("It should work")
wait(.1)
end
end)
I switched out position with CFrame so you can also have control over the rotation, which is the likely factor of the toothbrush issue.
Right as you made this post, I had already swithced the position to cframe. this is my results.
script.Parent.MouseButton1Click:Connect(function()
local player = script.Parent.Parent.Parent.Parent
local character = player.Character
local p = script:WaitForChild("Union"):Clone()
p.Parent = character
p.Name = "Toothbrush"
p.CFrame = character:FindFirstChild("LeftHand").CFrame
local dog = Instance.new("WeldConstraint")
dog.Parent = p
dog.Part0 = p
dog.Part1 = character.LeftHand
print("It should work")
wait(.1)
end)
I’d do the way I did mine, as by taking the CFrame like that, it not only takes the hand’s position, but it’s rotation (which could be different from the toothbrush, leaving it possibly sideways, upside-down, etc.)