Ragdoll System Help. Flying Glitch[SOLVED]

ill try that /.afdfdsaafdsafs
ill try that character limitt afdfdsafdsaafds

1 Like

still does nothing? character limittt minn

1 Like

send a ss of the server script where you listen for the event

1 Like

image
prints right and everything, just doesnt do anything

1 Like

I see the problem, your parameter is actually the player, not the character. do this instead:

local Misc = require(game.ReplicatedStorage.Misc)

local remoteEvent = game.ReplicatedStorage.RemoteEvent
remoteEvent.OnServerEvent:Connect(function(player)
    local character = player.Character
    Misc.Ragdoll(character, 10)
end)
1 Like

it works, but there was a quicker way of fixing by doing player, Character btw on server script. does it just not work on client ig?

1 Like

wdym, like saying in the localscript:

local character = player.Character
event:FireServer(player, character)

??

1 Like

no i mean im just asking and guessing that since we needed remote events the module doesnt work on client? so i should always do this from server correct? also it works so ty very much

1 Like

Yeah, since you need it to replicate to the server, doing it client-sided wouldn’t work. Glad I could help.

1 Like

and just out of curiosity why does it need to be replicated to the server?

1 Like

With filtering enabled, the server needs to make sure that it’s not some exploiter making changes to a guys character, so you need the server to oversee what is going on.

2 Likes

also say i wanted to make someone ragdoll in mid air as thwy were falling? how would i go about that? and is there a way to make ragdoll duration infinite?

1 Like

Sorry I took so long. I’ve modified both the local script and the R6 Ragdoll serverscript. Here is the local script:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

local runService = game:GetService("RunService")

local remoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")

local isFalling = false
local fallStartTime = 0

local function checkIfFalling()
	local humanoid = character:FindFirstChild("Humanoid")

	if humanoid then
		if humanoid:GetState() == Enum.HumanoidStateType.Freefall then
			if not isFalling then
				isFalling = true
				fallStartTime = tick()
			else
				local elapsedTime = tick() - fallStartTime
				if elapsedTime >= .7 then
					remoteEvent:FireServer()
					print("Ragdolled")
				end
			end
		else
			isFalling = false
			fallStartTime = 0
			print("Unragdolled")

			for i, values in pairs(character:GetChildren()) do
				if values:IsA("BoolValue") and values.Name == "Ragdoll" then
					values:Destroy()
				end
			end
		end
	end
end

runService.RenderStepped:Connect(checkIfFalling)

This checks if the player is falling in every frame (renderstepped). If they are, it waits .7 seconds and then ragdolls them. I did this wait to prevent it from ragdolling them after just jumping.
Here is the R6Ragdoll serverscript. Make sure to replace the actual script called R6Ragdoll’s code with this:

--[[ 

HOW TO USE IT:
- 1: Use CollectionService to tag the character you want to ragdoll with the tag "Ragdoll";
- 2: Once tagged the character will instantly go to ragdoll state;
- 3: To return from ragdoll, remove the tag.

If you're using my Misc module and you have the ChildAdded checks inside your NPCs or Dummies like mine,
you can just require the Misc module and use the miscModule.Ragdoll(Target, Duration) function.

--]]



-- SERVICES --
local CS = game:GetService("CollectionService")
local StarterPlayer = game:GetService("StarterPlayer")

-- MODULES --
local ragdollBuilder = require(script.RagdollBuilder)

-- MISC VARIABLES --
local ragdollParts = script.RagdollParts

script.RagdollClient.Parent = StarterPlayer.StarterCharacterScripts

game.Players.PlayerAdded:Connect(function(player)
	if not player.Character then
		player.CharacterAdded:Connect(function(char)

			local clones = {}
			for i, v in pairs(ragdollParts:GetChildren()) do
				clones[v.Name] = v:Clone()
			end

			for i, v in pairs(clones) do
				if v:IsA("Attachment") then
					v.Parent = char[v:GetAttribute("Parent")]
				elseif v:IsA("BallSocketConstraint") then
					v.Parent = char.Torso
					v.Attachment0 = clones[v:GetAttribute("0")]
					v.Attachment1 = clones[v:GetAttribute("1")]
				else
					v.Part0 = char.HumanoidRootPart
					v.Part1 = char.Torso
					v.Parent = char.HumanoidRootPart
				end
			end
		end)
	else
		local char = player.Character
		
		local clones = {}
		for i, v in pairs(ragdollParts:GetChildren()) do
			clones[v.Name] = v:Clone()
		end

		for i, v in pairs(clones) do
			if v:IsA("Attachment") then
				v.Parent = char[v:GetAttribute("Parent")]
			elseif v:IsA("BallSocketConstraint") then
				v.Parent = char.Torso
				v.Attachment0 = clones[v:GetAttribute("0")]
				v.Attachment1 = clones[v:GetAttribute("1")]
			else
				v.Part0 = char.HumanoidRootPart
				v.Part1 = char.Torso
				v.Parent = char.HumanoidRootPart
			end
		end
	end
end)

CS:GetInstanceAddedSignal("Ragdoll"):Connect(function(v)
	if v:IsA("Model") then
		ragdollBuilder:Ragdoll(v)
	end
end)

CS:GetInstanceRemovedSignal("Ragdoll"):Connect(function(v)
	if v:IsA("Model") then
		if v:FindFirstChild("Humanoid") and v:FindFirstChild("Humanoid"):GetState() ~= Enum.HumanoidStateType.Freefall then
			ragdollBuilder:Unragdoll(v)
		else
			return
		end
	end
end)

2 Likes

thanks so much, and if i want them to ragdoll forever what would i do for duration?

1 Like

The way that script works is it deletes the ragdoll tag once the player stops falling, so duration doesn’t mean anything. what i would say is if you want them to ragdoll forever, just use the previous script and set the duration to math.huge.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.