local ReplicatedStorage = game:GetService("ReplicatedStorage") local RagdollEvent = ReplicatedStorage:WaitForChild("RagdollEvent") -- دالة تحويل الشخصية إلى راغدول local function toggleRagdoll(character, enable) local humanoid = character:FindFirstChildOfClass("Humanoid") if not humanoid or humanoid.Health <= 0 then return end if enable then humanoid.PlatformStand = true for _, joint in ipairs(character:GetDescendants()) do if joint:IsA("Motor6D") and joint.Name ~= "Neck" then local socket = Instance.new("BallSocketConstraint") local a0 = Instance.new("Attachment") local a1 = Instance.new("Attachment") a0.Name = "RagdollA0" a1.Name = "RagdollA1" a0.CFrame = joint.C0 a1.CFrame = joint.C1 a0.Parent = joint.Part0 a1.Parent = joint.Part1 socket.Attachment0 = a0 socket.Attachment1 = a1 socket.Name = "RagdollSocket" socket.Parent = joint.Parent joint.Enabled = false end end else humanoid.PlatformStand = false for _, v in ipairs(character:GetDescendants()) do if v.Name == "RagdollSocket" or v.Name == "RagdollA0" or v.Name == "RagdollA1" then v:Destroy() end if v:IsA("Motor6D") then v.Enabled = true end end end end -- استقبال الطلب من اللاعب RagdollEvent.OnServerEvent:Connect(function(player, state) if player.Character then toggleRagdoll(player.Character, state) end end)