Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Drag system for my Ragdoll script?

ok so basically i've made a Ragdoll KO system that rag-dolls you at 30 hp untill you reach 39 HP and get back up. any way on how i could make a system where a player can carry/Drag a player that is Ragdolled by pressing a Key?

1 answer

Here is a basic way:

In your local script, set up two events for whichever key you want. The first event should be InputBegan and fires a remote event to activate a boolean in your server script. The second should be InputEnded, and declares that boolean as false. In the server script, set up a while loop which checks if your boolean is false or not. If not false, use SetPrimaryPartCFrame() to set the CFrame of the ragdoll to your torso multiplied by a certain CFrame value. If the value is false the while loop will break with an 'else' statement.

Hypothetically: Local:

local input = game:GetService("UserInputService")
input.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.E then
RemoteEvent1:FireServer()
end
end)

input.InputEnded:Connect(function(stop)
if stop.KeyCode == Enum.KeyCode.E then
RemoteEvent2:FireServer()
end
end)

Server:

local bool = false
RemoteEvent1.OnServerEvent:Connect(function(plr)
bool = true
end)

RemoteEvent2.OnServerEvent:Connect(function()
bool = false
end)

while wait() do
if bool == true then
Ragdoll:SetPrimaryPartCFrame(plr.Character.Torso.CFrame * CFrame.new(0,0, -5))
else
break
end
end

You can use magnitude to detect the ragdoll or any other method such as Touched.

This discussion is preserved as it was. New answers, comments, and votes are closed.