Why is it so hard to fling ragdoll character

I had lots of troubles while making a fling ragdoll character
because it had to use remote events
and i didn’t like the idea of having to use remote events, and had to use client sided code or else it wouldn’t work with the server scripts
and some technical issues

for example changing the humanoid state, I couldn’t just use a server script to change it and I used a remote event - else it didn’t work, it felt hacky and I just wanted to do it in the server so it be more organized and less code overall.

this is probably more of a rant on how annoying this is rather than an actual problem, but I just want to do this without the hassle of client code

one last thing, it works with dummys but not with the player character, doesn’t work with the humanoid state and the apply impulse/AssemblyLinearVelocity

if there is any way to make flinging ragdoll less complicated please tell me

Client Code

change state
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local characterState = ReplicatedStorage.CharacterState

local Players = game:GetService("Players")
local player = Players.LocalPlayer

characterState.OnClientEvent:Connect(function(state, bool)
	player.Character.Humanoid:ChangeState(Enum.HumanoidStateType[state], bool)
fling character
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local flingEvent = ReplicatedStorage.FlingCharacter

local Players = game:GetService("Players")
local player = Players.LocalPlayer

flingEvent.OnClientEvent:Connect(function(direction, force)
	player.Character.HumanoidRootPart:ApplyImpulse(direction * force)
enable/disable controls
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local PlayerModule = require(LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()

local controlEvent = ReplicatedStorage.ControlsEvent

	if enable then

Server Code

code to enable it
controlEvent:FireClient(player, false) --disable player controls
characterState:FireClient(player, "Physics", true) --make limbs collide
RagDoll.ragdoll(player.Character) --ragdoll player
flingEvent:FireClient(player, (player.Character.HumanoidRootPart.Position -flingPart.Position).Unit, flingForce) --makes player be fling
code to reset it
RagDoll.unragdoll(player.Character) --unragdolls player
characterState:FireClient(player, "Running", true) --had to set it to running or else the player is flopping on the floor
controlEvent:FireClient(player, true) --enable player controls

some bit of details

  • had to change the humanoid state otherwise the limbs will be colliding with the ground
  • had to use remote events otherwise the code won’t work on the server (ex. flinging and limbs not colliding with the ground)
  • and of course had to disable the controls for the player, dont want them to be walking while being ragdolled
  • also I could of combined all the client code into one local script but I kinda separated it to see what it was doing
  • I think I’ve spent an entire week trying to get this ragdoll fling thing to actually work, it was kinda hard to find solutions that would actually would work for me, but I found some that work and there were many that sorta worked but were a bit too hacky for me such as (run service loop to make the limbs collide) it would work in theory but it could also allow people to noclip through walls)
  • most ragdoll tutorials had the character dying and then ragdoll them, but for me I want the character to ragdoll even tho its not dead yet.

I used this for the ragdoll script

Video Demonstation

1 Like