When make it into a ragdoll, the ragdoll is fly

I’m currently writing a script that turns into a ragdoll when it touches the hit box. But somehow the ragdoll player flies away. I know I can use platform stand, but if that happens,
The Can Collide on the arms and legs seems to go out. Even without platform stand,
Please help me not to fly!
sctipt is here

Settings.Hitbox.Touched:Connect(function(Hit)
	local effect = script.Parent.Handle.RRR:Clone()
	local Mod = Hit.Parent
	
	if CanDamage == true then 
	
		while not Mod:FindFirstChild("Humanoid") and Mod.Parent ~= game do 
			Mod = Mod.Parent
		end
		local Hum = Mod:FindFirstChild("Humanoid")
		local isblock = Hum:FindFirstChild("isblock")
		if game.Players:findFirstChild(Hum.Parent) then 
			local TarPlr = game.Players:findFirstChild(Hum.Parent)
			if Settings.TeamKill == false then
				
				if isblock then
					if isblock.Value == true then
						local hitSFX = Instance.new("Sound",Hit.Parent.Head)
						hitSFX.SoundId = "rbxassetid://131237241"
						hitSFX.Volume = 2
						hitSFX:Play()
						Hum:TakeDamage(5)
					elseif isblock.Value == false then
						Hum:TakeDamage(5)
						local Creator_Tag = Instance.new("ObjectValue")
						Creator_Tag.Name = "creator"
						Creator_Tag.Value = Plr
						Creator_Tag.Parent = Hum
						game:GetService('Debris'):AddItem(Creator_Tag, 2)
					end
				end
				CanDamage = false
				if Hum.Health == Hum.MaxHealth then
			
				else
					if isblock.Value == false then
						Hum:TakeDamage(5)
						for _, v in pairs(Hit.Parent:GetDescendants()) do
							if v:IsA("Motor6D") then
								local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
								a0.CFrame = v.C0
								a1.CFrame = v.C1
								a0.Parent = v.Part0
								a1.Parent = v.Part1
								local b = Instance.new("BallSocketConstraint")
								b.Attachment0 = a0
								b.Attachment1 = a1
								b.Parent = v.Part0
								v.Enabled = false
							end
						end
						local Creator_Tag = Instance.new("ObjectValue")
						Creator_Tag.Name = "creator"
						Creator_Tag.Value = Plr
						Creator_Tag.Parent = Hum
						game:GetService('Debris'):AddItem(Creator_Tag, 2)
						effect.Parent = Hit.Parent.Head
						effect['Barrage [A]']:Emit(3)
						effect.Dots:Emit(1)
						effect["Lines [1]"]:Emit(3)
						effect["Lines [2]"]:Emit(3)
						local hitSFX = Instance.new("Sound",Hit.Parent.Head)
						hitSFX.SoundId = "rbxassetid://566593606"
						hitSFX.Volume = 2
						hitSFX:Play()
						wait(0.4)
						effect:Destroy()
						wait(1)
						for _,v in pairs(Hit.Parent:GetDescendants()) do  --unragdoll
							if v:IsA('Motor6D') then
								v.Enabled = true
							end
							if v.Name == 'BallSocketConstraint' then
								v:Destroy()
							end
							if v.Name == 'Attachment' then
								v:Destroy()
							end
						end
					end
				end
			elseif Settings.TeamKill == true or TarPlr.Neutral == true then
				CanDamage = false
				if Hum.Health == Hum.MaxHealth then
					
				else
					Hum:TakeDamage(5)
					for _, v in pairs(Hit.Parent:GetDescendants()) do
						if v:IsA("Motor6D") then
							local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
							a0.CFrame = v.C0
							a1.CFrame = v.C1
							a0.Parent = v.Part0
							a1.Parent = v.Part1
							local b = Instance.new("BallSocketConstraint")
							b.Attachment0 = a0
							b.Attachment1 = a1
							b.Parent = v.Part0
							v.Enabled = false
						end
					end
					local Creator_Tag = Instance.new("ObjectValue")
					Creator_Tag.Name = "creator"
					Creator_Tag.Value = Plr
					Creator_Tag.Parent = Hum
					game:GetService('Debris'):AddItem(Creator_Tag, 2)
					effect.Parent = Hit.Parent.Head
					effect['Barrage [A]']:Emit(3)
					effect.Dots:Emit(1)
					effect["Lines [1]"]:Emit(3)
					effect["Lines [2]"]:Emit(3)
					local hitSFX = Instance.new("Sound",Hit.Parent.Head)
					hitSFX.SoundId = "rbxassetid://566593606"
					hitSFX.Volume = 2
					hitSFX:Play()
					wait(0.4)
					effect:Destroy()
					wait(1)
					for _,v in pairs(Hit.Parent:GetDescendants()) do  --unragdoll
						if v:IsA('Motor6D') then
							v.Enabled = true
						end
						if v.Name == 'BallSocketConstraint' then
							v:Destroy()
						end
						if v.Name == 'Attachment' then
							v:Destroy()
						end
					end
				end
			end
	
		else 
			
			if Settings.KillNPCs == true then
				Hum:TakeDamage(5)
				CanDamage = false
				if Hum.Health == Hum.MaxHealth then
				else
					for _, v in pairs(Hit.Parent:GetDescendants()) do
						if v:IsA("Motor6D") then
							local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
							a0.CFrame = v.C0
							a1.CFrame = v.C1
							a0.Parent = v.Part0
							a1.Parent = v.Part1
							local b = Instance.new("BallSocketConstraint")
							b.Attachment0 = a0
							b.Attachment1 = a1
							b.Parent = v.Part0
							v.Enabled = false
						end
					end
					local Creator_Tag = Instance.new("ObjectValue")
					Creator_Tag.Name = "creator"
					Creator_Tag.Value = Plr
					Creator_Tag.Parent = Hum
					game:GetService('Debris'):AddItem(Creator_Tag, 2)
					effect.Parent = Hit.Parent.Head
					effect['Barrage [A]']:Emit(3)
					effect.Dots:Emit(1)
					effect["Lines [1]"]:Emit(3)
					effect["Lines [2]"]:Emit(3)
					local hitSFX = Instance.new("Sound",Hit.Parent.Head)
					hitSFX.SoundId = "rbxassetid://566593606"
					hitSFX.Volume = 2
					hitSFX:Play()
					wait(0.4)
					effect:Destroy()
					wait(1)
					for _,v in pairs(Hit.Parent:GetDescendants()) do  --unragdoll
						if v:IsA('Motor6D') then
							v.Enabled = true
						end
						if v.Name == 'BallSocketConstraint' then
							v:Destroy()
						end
						if v.Name == 'Attachment' then
							v:Destroy()
						end
					end
				end
			else 
				return
			end
			
		end
	end
end)

and… video is this
robloxapp-20220806-1251504.wmv (1.9 MB)

1 Like