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

My tool keeps on changing positions how do I fix it?

Asked by 9 years ago

Well my question is why does my puppet change positions? I've had this for too long and I really need a anwser, everytime I pull the tool out it's good at the first time but like 2nd and 3rd time then it keeps changing positions like when I have it forward it stays like that when I deselect it and select it again then it has his body positioned to the sky or the ground. It's a glitch and I need it fixed, please I think it has something to do with the Welding and Arm Movement, I use stickmasterluke's weld script so I think it's old but I just need to fix this Weld Script:

function Weld(x,y)
    local W = Instance.new("Weld")
    W.Part0 = x
    W.Part1 = y
    local CJ = CFrame.new(x.Position)
    local C0 = x.CFrame:inverse()*CJ
    local C1 = y.CFrame:inverse()*CJ
    W.C0 = C0
    W.C1 = C1
    W.Parent = x
end

function Get(A)
    if A.className == "Part" then
        Weld(script.Parent.Handle, A)
        A.Anchored = false
    else
        local C = A:GetChildren()
        for i=1, #C do
        Get(C[i])
        end
    end
end

function Finale()
    Get(script.Parent)
end

script.Parent.Equipped:connect(Finale)
script.Parent.Unequipped:connect(Finale)
Finale()

Arm Movement Script:

--Stickmasterluke

--just put this script under the tool and when weilded the left arm will go up aswell.
tool=script.Parent
while true do
    if tool.Parent.Parent.Name=="Workspace" then
        local la=tool.Parent:FindFirstChild("Left Arm")
        local ra=tool.Parent:FindFirstChild("Left Arm")
        local ts=tool.Parent:FindFirstChild("Torso")
        if la~=nil and ts~=nil and ra~=nil then
            local ls=ts:FindFirstChild("Left Shoulder")
            local rs=ts:FindFirstChild("Right Shoulder")
            if ls~=nil and rs~=nil then
                ls.CurrentAngle=rs.CurrentAngle*-1
                ls.MaxVelocity=0
            end
        end
    end
wait(.01)  --If arm looks glitchy, then make this number smaller. And avoid setting to 0(game will crash).
end 

Thanks for reading and hopefully you can anwser my question

Answer this question