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

Why is part freezing in place once it gets welded to the player's lower leg or foot?

Asked by 5 years ago

I have been making a game that requires players to wear a full body suit that gets welded to their body. I made a script & everything works fine until I get to any of the parts that are meant to be welded to the players lower legs, whenever one of them gets welded it just freezes on the players leg & stops them from moving. I used the same script on every part, the only difference is the target parts so I don't know why these ones aren't working.

Here is the code:

script.Parent.Touched:Connect(function(hit)
    humanoid = hit.Parent:findFirstChild("Humanoid")
    if humanoid then
        if script.Parent:FindFirstChild("weld") == nil then
            rightLowerLeg = hit.Parent.RightLowerLeg
            script.Parent.CFrame = rightLowerLeg.CFrame * CFrame.new(0, -0.3155, 0)
            weld = Instance.new("Weld")
            weld.Part0 = rightLowerLeg
            weld.C0 = rightLowerLeg.CFrame:Inverse()
            weld.Part1 = script.Parent
            weld.C1 = script.Parent.CFrame:Inverse()
            weld.Parent = script.Parent
            weld.Parent.Anchored = false
        end
    end
end)

I have also tried welding them to the player's foot but it still does the same thing. I have made sure that it isn't anchored before AND after the script has run.

1 answer

Log in to vote
0
Answered by 5 years ago

Nvm I just remade the part & it worked.

Ad

Answer this question