Waiting for just a moment, and then freezing a ragdoll in place

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to create a kill effect in my battle simulator where the victim ragdolls for a moment, and then freezes into that ragdoll. Kind of like this screenshot:
  2. What is the issue? Include screenshots / videos if possible!
    I CANNOT get the correct time to wait to make it work correctly. If it waits too long it just changes the material of a motionless thing on the ground, too short and it freezes them in a boring default holding tool position. I am desperate.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Using wait() waits for nearly a second or more due to the lag of too many NPCs at once (too long). Using RunService.HeartBeat:Wait(n) instantly passes, and RunService.Stepped, RenderStepped, etc. NEVER run.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local humanoidofcharacter = character:FindFirstChild("Humanoid")
	addToSet(tagged, humanoid)
	if maximumVIOLENCE then
		humanoidofcharacter:TakeDamage(500)
	else
		humanoidofcharacter:TakeDamage(3)
	end
	if humanoidofcharacter.health <= 0 then
		local torso = character:FindFirstChild("Torso")
		if torso then
			local bodyBodyVelocity = Instance.new("BodyVelocity")
			bodyBodyVelocity.Velocity = Character.PrimaryPart.CFrame.LookVector * 5000
			bodyBodyVelocity.Parent = character.PrimaryPart
			Debris:AddItem(bodyBodyVelocity, 0.1)
		end
		local yes
		RunService.Heartbeat:Wait(1500)
		local ICEDCOPY = OOF_ICED:Clone()
		ICEDCOPY.Parent = humanoidofcharacter
		ICEDCOPY.PlayOnRemove = true
		ICEDCOPY:Destroy()
		for _,C in pairs(character:GetDescendants()) do
			if C:IsA("Motor6D") then
				local socket = Instance.new("WeldConstraint",C.Parent)
				socket.Part0,socket.Part1 = C.Part0,C.Part1
				C:Destroy() -- keep it only if ur ragdolling on death
			elseif C:IsA("BallSocketConstraint") then
				local New = Instance.new("WeldConstraint", C.Parent)
				local p0,p1 = C.Attachment0.Parent,C.Attachment1.Parent
				New.Part0 = p0
                                -- ...

How would I do this?
Screenshot 2023-09-25 184202
What happens if its too short (Runservice.Heartbeat)
Screenshot 2023-09-25 184258
What I want to happen (Wait like 0.1 - 0.5 seconds in real time)


What waiting too long happens (wait())
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

Nevermind, Solved. Turns out I was using Heartbeat:Wait() incorrectly. The number input isn’t actually the number of times to wait for this event to fire, but something to do with deltatime (yes, I know I’m dumb.) I just made a hacky solution with a while loop that runs Heartbeat:Wait() 15 times.

1 Like

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