You can write your topic however you want, but you need to answer these questions:
-
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: -
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. -
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?
What happens if its too short (Runservice.Heartbeat)
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.