Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does welding make me float in the air?

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?

2 answers

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

2 comments

0

Didn't work. I still float in the air. But, thanks for trying.

0

Edited.

It's because achored is true, You basically welded yourself to a imobile part Turn anchored to false

script.parent.Anchored = false

1 comment

0

Didn't work. I still float in the air.

This discussion is preserved as it was. New answers, comments, and votes are closed.