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

Ragdoll makes my limbs go completely into my torso?

Asked by 5 years ago
game.Players.PlayerAdded:Connect(function(plr)
    print("plr joined")
    plr.CharacterAdded:Connect(function(char)
        wait(5)
        for i = 1,10 do
            print("Ragdoll starting")
            wait(1)
        end
        local bv = Instance.new("BoolValue", char)
        bv.Name = "RagdollTime"

        local hum = char:WaitForChild("Humanoid")

        local H0 = Instance.new("Attachment")
        H0.Name = "HeadAttachment0"
        H0.Parent = char.Torso
        local H1 = Instance.new("Attachment")
        H1.Name = "HeadAttachment1"
        H1.Parent = char.Head
        local H = Instance.new("BallSocketConstraint")
        H.Attachment0 = H0
        H.Attachment1 = H1
        H.Parent = char.Torso


        local LA1 = Instance.new("Attachment")
        LA1.Name = "LArmAttachment1"
        LA1.Parent = char["Left Arm"]
        local LA = Instance.new("BallSocketConstraint")
        LA.Attachment0 = H0
        LA.Attachment1 = LA1
        LA.Parent = char.Torso


        local RA1 = Instance.new("Attachment")
        RA1.Name = "RArmAttachment1"
        RA1.Parent = char["Right Arm"]
        local RA = Instance.new("BallSocketConstraint")
        RA.Attachment0 = H0
        RA.Attachment1 = RA1
        RA.Parent = char.Torso


        local LH1 = Instance.new("Attachment")
        LH1.Name = "LHrmAttachment1"
        LH1.Parent = char["Left Leg"]
        local LH = Instance.new("BallSocketConstraint")
        LH.Attachment0 = H0
        LH.Attachment1 = LH1
        LH.Parent = char.Torso

        local RH1 = Instance.new("Attachment")
        RH1.Name = "RHrmAttachment1"
        RH1.Parent = char["Right Leg"]
        local RH = Instance.new("BallSocketConstraint")
        RH.Attachment0 = H0
        RH.Attachment1 = RH1
        RH.Parent = char.Torso

        hum.PlatformStand = true

        for i,v in pairs(char.Torso:GetChildren()) do
            if v:IsA("Motor6D") then
                v:Destroy()
            end
        end
    end)
end)

nothing prints out btw

0
As far as I know, you can't have nested events SteamG00B 1633 — 5y
0
steamgod that isnt the point, if it changed something, that means the game already knows about it and doesnt need to wait anymore :/ OfficalRobloxWeb 12 — 5y
0
You don't understand, what I mean by a "nested event" is an event inside another event. It won't be able to detect if a player's character has been added unless it changed right at that very moment. SteamG00B 1633 — 5y
0
This isn't true. Hooking up event listeners in this way is the standard practice. The player.CharacterAdded event listener lasts for the lifetime of the player object, and will be called on every respawn. EmilyBendsSpace 1025 — 5y

1 answer

Log in to vote
0
Answered by
SteamG00B 1633 Moderation Voter
5 years ago
Edited 5 years ago

Mark this as the accepted answer if it solves your question.

Instead of having a nested event, all you need to do is wait for the character to load via a WaitForChild:

game.Players.PlayerAdded:Connect(function(plr)
    print("plr joined")
    local char = plr:WaitForChild("Character") --replace the event with a wait and it might solve your problem
        wait(5)
        for i = 1,10 do
            print("Ragdoll starting")
            wait(1)
        end
        local bv = Instance.new("BoolValue", char)
        bv.Name = "RagdollTime"

        local hum = char:WaitForChild("Humanoid")

        local H0 = Instance.new("Attachment")
        H0.Name = "HeadAttachment0"
        H0.Parent = char.Torso
        local H1 = Instance.new("Attachment")
        H1.Name = "HeadAttachment1"
        H1.Parent = char.Head
        local H = Instance.new("BallSocketConstraint")
        H.Attachment0 = H0
        H.Attachment1 = H1
        H.Parent = char.Torso


        local LA1 = Instance.new("Attachment")
        LA1.Name = "LArmAttachment1"
        LA1.Parent = char["Left Arm"]
        local LA = Instance.new("BallSocketConstraint")
        LA.Attachment0 = H0
        LA.Attachment1 = LA1
        LA.Parent = char.Torso


        local RA1 = Instance.new("Attachment")
        RA1.Name = "RArmAttachment1"
        RA1.Parent = char["Right Arm"]
        local RA = Instance.new("BallSocketConstraint")
        RA.Attachment0 = H0
        RA.Attachment1 = RA1
        RA.Parent = char.Torso


        local LH1 = Instance.new("Attachment")
        LH1.Name = "LHrmAttachment1"
        LH1.Parent = char["Left Leg"]
        local LH = Instance.new("BallSocketConstraint")
        LH.Attachment0 = H0
        LH.Attachment1 = LH1
        LH.Parent = char.Torso

        local RH1 = Instance.new("Attachment")
        RH1.Name = "RHrmAttachment1"
        RH1.Parent = char["Right Leg"]
        local RH = Instance.new("BallSocketConstraint")
        RH.Attachment0 = H0
        RH.Attachment1 = RH1
        RH.Parent = char.Torso

        hum.PlatformStand = true

        for i,v in pairs(char.Torso:GetChildren()) do
            if v:IsA("Motor6D") then
                v:Destroy()
            end
        end
end)
Ad

Answer this question