Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Ragdoll makes my limbs go completely into my torso?

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

4 comments

0

As far as I know, you can't have nested events

0

steamgod that isnt the point, if it changed something, that means the game already knows about it and doesnt need to wait anymore :/

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.

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.

1 answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.