So i have my script which works totally fine with my mesh part, meaning it welds and everything. But when I use it in game the player causes the mesh to sink into the ground making it nearly invisible unless the player is moving. Is there anyway to fix this issue? . But is there anyway i can keep the mesh above ground acting as a shoe elevating the player as well? Link to see problem https://ibb.co/J3w8x0z

script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") ~= nil and hit.Parent:FindFirstChild("Leg1") == nil then
        local G = script.Parent.Parent:WaitForChild("Leg1"):Clone()
        G.Parent = hit.Parent

        local M = G:WaitForChild("Middle")
        for B, C in pairs(G:GetChildren()) do
            if C:IsA("BasePart") then
                local W = Instance.new("Weld")
                local CJ = CFrame.new(M.Position)
                W.Part0 = M
                W.Part1 = C
                W.C0 = M.CFrame:inverse() * CJ
                W.C1 = C.CFrame:inverse() * CJ
                W.Parent = M
            end 
        local Y = Instance.new("Weld")
        Y.Part0 = hit.Parent:WaitForChild("LeftFoot")
        Y.Part1 = M
        Y.C0 = CFrame.new(0, 0, 0)
        Y.Parent = hit.Parent:WaitForChild("LeftFoot")
        end

        for I, H in pairs(G:GetChildren()) do
            if H:IsA("BasePart") then
                H.Anchored = false
                H.CanCollide = true
            end
        end
    end

    if hit.Parent:FindFirstChild("Humanoid") ~= nil and hit.Parent:FindFirstChild("Leg2") == nil then
        local G = script.Parent.Parent:WaitForChild("Leg2"):Clone()
        G.Parent = hit.Parent

        local M = G:WaitForChild("Middle")
        for B, C in pairs(G:GetChildren()) do
            if C:IsA("BasePart") then
                local W = Instance.new("Weld")
                local CJ = CFrame.new(M.Position)
                W.Part0 = M
                W.Part1 = C
                W.C0 = M.CFrame:inverse() * CJ
                W.C1 = C.CFrame:inverse() * CJ
                W.Parent = M
            end 
        local Y = Instance.new("Weld")
        Y.Part0 = hit.Parent:WaitForChild("RightFoot")
        Y.Part1 = M
        Y.C0 = CFrame.new(0, 0, 0)
        Y.Parent = hit.Parent:WaitForChild("RightFoot")
        end

        for I, H in pairs(G:GetChildren()) do
            if H:IsA("BasePart") then
                H.Anchored = false
                H.CanCollide = true
            end
        end
    end
end)

2 comments

0

just create a link of the picture

0

just added it