Model in Marketplace: Slap Battles Ragdoll
Showcasing:
How does this work? In a Model that has a Humanoid, a attribute is created, with which, when the state changes, this character enters and exits ragdoll
Setup:
- Download this asset. And put it in
ServerStorage
Ragdoll Module.luau - Create a
ScriptinServerScriptServiceand paste the following code into it to activate the ragdoll
local Players = game:GetService('Players')
local ServerStorage = game:GetService('ServerStorage')
local ragdollModule = require(ServerStorage.RagdollModule)
local function main(v:Humanoid?)
if not v:IsA('Humanoid') or not v.Parent then return end
local character = v.Parent
local player = Players:GetPlayerFromCharacter(character)
if not script:GetAttribute('NPCs') and not player then return end
character:SetAttribute('Ragdoll',false)
local function onGetAttributeChangedSignal()
if character:GetAttribute('Ragdoll') then
ragdollModule.ragdoll(character)
else
ragdollModule.unRagdoll(character)
end
end
character:GetAttributeChangedSignal('Ragdoll'):Connect(onGetAttributeChangedSignal)
v.BreakJointsOnDeath = false
local function onDied()
ragdoll.Value = true
end
v.Died:Once(onDied)
end
workspace.DescendantAdded:Connect(main)
for _,v in workspace:GetDescendants() do
main(v)
end
-
Create a attribute in this script and name it “NPCs”. If you set this to
true, non-player rigs will also have ragdoll

-
Create a
UnreliableRemoteEventinReplicatedStorageand name it “StateEvent” -
Create a
LocalScriptinStarterCharacterScriptsand paste the following code into it to prevent certain player ragdoll glitches
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local stateEvent = ReplicatedStorage.StateEvent
local character = script.Parent
local humanoid:Humanoid = character:WaitForChild('Humanoid')
local function onClientEvent(status)
if not humanoid.Parent then return end
humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp,status)
humanoid:ChangeState(status and Enum.HumanoidStateType.GettingUp or Enum.HumanoidStateType.Physics)
end
stateEvent.OnClientEvent:Connect(onClientEvent)
Thanks for using this! ![]()