Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Why does welding make me float in the air?

Asked by
Probix 80
8 years ago
Edited 8 years ago

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.

01function WeldingTesting(hit)
02    local humanoid = hit.Parent:FindFirstChild("Humanoid")
03    if humanoid then
04        local torso = hit.Parent.Torso
05        local weld = Instance.new("Weld")
06        weld.Part0 = torso
07        weld.C0 = torso.CFrame:inverse()
08        weld.Part1 = script.Parent
09        weld.C1 = script.Parent.CFrame:inverse()
10        weld.Parent = script.Parent
11        script.Parent.CFrame = torso.CFrame * CFrame.new(5,10,5)
12        script.Parent.Anchored = false
13        script.Parent.CanCollide = false
14    end
15end
16 
17script.Parent.Touched:connect(WeldingTesting)

Please help?

2 answers

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

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:

1script.Parent.CanCollide = false

Hope I helped!

~TDP

0
Didn't work. I still float in the air. But, thanks for trying. Probix 80 — 8y
0
Edited. TheDeadlyPanther 2460 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

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

1script.parent.Anchored = false
0
Didn't work. I still float in the air. Probix 80 — 8y

Answer this question