I'm made a part that if touched, it would weld to the torso...but every time I touch it, it would cause me to float in the air and get stuck.
function WeldingTesting(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then local torso = hit.Parent.Torso local weld = Instance.new("Weld") weld.Part0 = torso weld.C0 = torso.CFrame:inverse() weld.Part1 = script.Parent weld.C1 = script.Parent.CFrame:inverse() weld.Parent = script.Parent script.Parent.CFrame = torso.CFrame * CFrame.new(5,10,5) script.Parent.Anchored = false script.Parent.CanCollide = false end end script.Parent.Touched:connect(WeldingTesting)
Please help?
EDIT:
I think I have figure it out. I have been experiencing the same problem with tools lying on the ground. When I weld them to my character, they weld him to the ground. Here is my fix:
Try cloning the part into the player, weld it, then delete the original part.
If that doesn't work, you will have to store the part inside a LocalScript inside the player or something, and weld it from there.
I'm not sure why this bug exists, but it does. Maybe because the part get's welded to the ground somehow? Maybe it's because when it get's welded, the part is somehow locked into position?
This is because:
1. The part is anchored.
2. ROBLOX welding gets glitchy with parts with CanCollide set to true (in some cases, anyway). Set CanCollide to false:
script.Parent.CanCollide = false
Hope I helped!
~TDP
It's because achored is true, You basically welded yourself to a imobile part Turn anchored to false
script.parent.Anchored = false