Hello! I was wondering if I could have a rag doll as a tool and make it throwable? Is this possible? Ok so, there will be a tool, (the rag doll) the tool can neither be equipped or unequipped, it’s in the players arms when joined. When you click anywhere the rag doll will be throw in that direction, you would wan 2 seconds before the rag doll regenerates to your hands
Any help is appreciated!!
Can you explain more of what you mean? Are you talking about throwing a model that destroys the tool when thrown?
There is a tool that is a rag doll person, so basically someone is holding a person who is a rag doll, then when thrown, it will do what a rag doll does best, move in weird ways…
Does it unequip? I need specific details so I can come up with a solution.
Ok so, there will be a tool, (the rag doll) the tool can neither be equipped or unequipped, it’s in the players arms when joined. When you click anywhere the rag doll will be throw in that direction, you would wan 2 seconds before the rag doll regenerates to your hands.
What you’re gonna need are two instances; a localscript and a part (or ragdoll). The ragdoll’s primarypart should be set to the HumanoidRootPart or LowerTorso, I recommend HumanoidRootPart if there is one.
This is what should be in the StarterCharacterScripts:
When you’ve done the above steps, you’re gonna need the localscript’s code to throw it. It’s very simple.
I’m assuming your character is R15, if not then the weld’s part1 should be “RightArm.”
Code:
local model = script.Parent:WaitForChild("Ragdoll") --set Ragdoll to name
local debounce = false
local weld = Instance.new("Weld",model)
weld.Part0 = model.PrimaryPart
weld.Part1 = script.Parent:WaitForChild("RightHand")
game.Players.LocalPlayer:GetMouse().Button1Down:Connect(function()
if not debounce then
debounce = true
weld:Destroy()
local clone = model:Clone()
clone:SetPrimaryPartCFrame(clone.PrimaryPart.CFrame + Vector3.new(0,5,0))
clone.PrimaryPart.Velocity = game.Players.LocalPlayer:GetMouse().Hit.LookVector*65
clone.Parent = workspace
for _,v in pairs(model:GetDescendants()) do
if v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("BasePart") then
v.Transparency = 1
end
end
wait(2)
for _,v in pairs(model:GetDescendants()) do
if v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("BasePart") then
v.Transparency = 0
end
end
weld = Instance.new("Weld",model)
weld.Part0 = model.PrimaryPart
weld.Part1 = script.Parent:WaitForChild("RightHand")
debounce = false
wait(3)
clone:Destroy()
end
end)
I hope this helped you.
Proof it works:
https://gyazo.com/b5fc0e5bc85fbec66739b10e3dba7c95
You can also make it server-sided, where it doesn’t just be local. This should be the hierachy:
Now we’re going to put this code into the LocalScript:
game.Players.LocalPlayer:GetMouse().Button1Down:Connect(function()
script:WaitForChild("RemoteEvent"):FireServer(game.Players.LocalPlayer:GetMouse().Hit.LookVector*65)
end)
It’s kind-of a hacky method for what’s coming next, but whatever.
Server-sided script:
local model = script.Parent.Parent:WaitForChild("Ragdoll") --set Ragdoll to name
local debounce = false
local weld = Instance.new("Weld",model)
weld.Part0 = model.PrimaryPart
weld.Part1 = script.Parent.Parent:WaitForChild("RightHand")
script.Parent:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(p,v)
if not debounce then
debounce = true
local clone = model:Clone()
clone:SetPrimaryPartCFrame(clone.PrimaryPart.CFrame + Vector3.new(0,5,0))
clone.PrimaryPart.Velocity = v
clone:WaitForChild("Weld"):Destroy()
clone.Parent = workspace
for _,v in pairs(model:GetDescendants()) do
if v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("BasePart") then
v.Transparency = 1
end
end
wait(2)
for _,v in pairs(model:GetDescendants()) do
if v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("BasePart") then
v.Transparency = 0
end
end
debounce = false
wait(3)
clone:Destroy()
end
end)
I run into this problem:
https://i.gyazo.com/c342d7aee0adc6e0d67c8c3e0ca19d6a.gif
You did solve the full problem, just wanting to know how to fix this? Thanks by the way!
Is your ragdoll bigger than the player, or small enough to fit into the hand?
If the ragdoll is bigger than the player, this can result in glitching.
I’ve shrunken it, but more glitches happen, the arm dosen’t raise, make my character move. The rag doll can no longer shrunk. This is it’s minimum size:
Silly me. I’ll come up with a solution in a minute. Be patient for me, please.
Sorry for the long wait. I’ve come up with a good solution but it won’t have any animations if you’re using a humanoid. You’re gonna have to delete the humanoid of the ragdoll and have this hierachy:
Your ragdoll should look like this inside:
(I named HumanoidRootPart Handle, don’t worry about it.)
I fixed it so your arm raises and you don’t flop in a rotation and the ragdoll doesn’t collide with your character.
LocalScript:
game.Players.LocalPlayer:GetMouse().Button1Down:Connect(function()
script:WaitForChild("RemoteEvent"):FireServer(game.Players.LocalPlayer:GetMouse().Hit.LookVector*65)
end)
while true do
game:GetService("RunService").Heartbeat:Wait()
if script.Parent.Parent ~= game.Players.LocalPlayer.Character then
game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):EquipTool(script.Parent)
end
end
Normal script:
local model = script.Parent.Parent:WaitForChild("Handle") --set Ragdoll to name
local debounce = false
local weld = Instance.new("Weld",model)
weld.Part0 = model.PrimaryPart
weld.Part1 = script:FindFirstAncestorOfClass("Model"):WaitForChild("RightHand")
script.Parent:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(p,v)
if not debounce then
debounce = true
local clone = model:Clone()
clone:SetPrimaryPartCFrame(clone.PrimaryPart.CFrame + Vector3.new(0,5,0))
clone.HumanoidRootPart.Velocity = v
clone:WaitForChild("Weld"):Destroy()
clone.Parent = workspace
for _,v in pairs(model:GetDescendants()) do
if v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("BasePart") or v:IsA("Texture") or v:IsA("Decal") then
v.Transparency = 1
end
end
wait(2)
for _,v in pairs(model:GetDescendants()) do
if v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("BasePart") or v:IsA("Texture") or v:IsA("Decal") then
v.Transparency = 0
end
end
debounce = false
wait(3)
clone:Destroy()
end
end)
Make sure it’s massless, unanchored, and cancollide is on.
I hope this helps!