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

Why isn't the pulley staying on the cable?

Asked by 8 years ago

I have a script in a button that the player walks on below.

local char
local larm
local rarm

script.Parent.Touched:connect(function(hit)
    if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid").Health > 0 then
        char = hit.Parent
        larm = char:FindFirstChild("Left Arm")
        rarm = char:FindFirstChild("Right Arm")

        local pulleyStorage = game.ServerStorage:WaitForChild("Pulley")

        local pulley = pulleyStorage:Clone()
        pulley.Parent = game.Workspace



        char:MoveTo(pulley.Part1.Position - Vector3.new(0,4,0))     

        local weld = Instance.new("Weld")
        weld.Part0 = larm
        weld.Part1 = pulley.LArm
        --weld.C0 = larm.CFrame:inverse()
        --weld.C1 = pulley.LArm.CFrame:inverse()
        weld.Parent = pulley.LArm

        local weld = Instance.new("Weld")
        weld.Part0 = rarm
        weld.Part1 = pulley.RArm
        --weld.C0 = rarm.CFrame:inverse()
        --weld.C1 = pulley.RArm.CFrame:inverse()
        weld.Parent = pulley.RArm

        pulley.PrimaryPart.CFrame = CFrame.new(-190.189835, 50.8000755, 196.333801, 0.866025269, 0, 0.500000238, 0, 1, 0, -0.500000238, 0, 0.866025269)

        wait(2)     

        for i, v in pairs(pulley:GetChildren()) do
            if(v:IsA("BasePart")) then
                v.Anchored = false
            end
        end

    end
end)

Basically what the script does, is check when the player steps on the button, clones a pulley into workspace and anchors that pulley so the cable goes through the pulley, welds the player's arms to the pulley, and then unanchors the pulley so that the pulley should go down the cable.

The problem is that when the pulley is unanchored, it simple falls right through the cable instead of suspending the character in the air. There is a two second wait I added so you can see this. I also don't understand why the player's arms don't go up, I thought they were free moving joints...

Here is a gif to help better understand the problem. Notice the player is welded and suspended and the cable goes through the pulley, and then the pulley falls through the cable when its unanchored.

https://gyazo.com/703e77c20fe74f982eb392d2dfebb0be

I don't know if its a problem with my script, or just a physics thing. Any helpful information for fixing my problem, or another way of doing this would be appreciated.

0
I wish I could help because this could be useful to me too rollercoaster57 65 — 8y
0
I'm trying some different things. Have had a little more success... dragonkeeper467 453 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

If the Pulley is not supposed to move I suggest making sure it is anchored or if it is supposed to move with a different object I suggest you insert a few lines to weld it together

local Part0 = Pulley local Part1 = Object to Move With local Weld = Instance.new('Weld') Weld.Part0 = Part0 Weld.Part1 = Part1 This is fully functional this is basically the same script I am using for one of my games I just made it a little simpler in case you are new to scripting. Just replace "Object to Move With" with the desired block to move the Pulley along with.

0
I did that... Its all welded together and positioned so a wire goes in between it. dragonkeeper467 453 — 8y
Ad

Answer this question