Hey DevForums! I was working on a tool that makes others ragdoll, and it works fine and all. Except one problem. The problem is, the player is ragdolled, but is still ‘standing up’.
Video: - YouTube
Scripts:
Server Script:
local Tool = script.Parent
local Debris = game:GetService("Debris");
local RunService = game:GetService("RunService");
local CanDamage = false;
local Swing = false;
local Debounce = Tool:WaitForChild("Debounce")
Tool.Equipped:Connect(function()
local Character = Tool.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local IdleTrack = Humanoid:LoadAnimation(script:WaitForChild("Idle"))
IdleTrack:Play(0.25)
Tool.Handle.Equip:Play()
Tool:WaitForChild("Equipped").Value = true;
Tool.Unequipped:Connect(function()
IdleTrack:Stop(0.25)
Tool:WaitForChild("Equipped").Value = false;
end)
end)
Tool.Activated:Connect(function()
local Character = Tool.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local SwingTrack1 = Humanoid:LoadAnimation(script:WaitForChild("Swing1"))
local SwingTrack2 = Humanoid:LoadAnimation(script:WaitForChild("Swing2"))
if Debounce.Value == false then
Debounce.Value = true;
CanDamage = true;
if not Swing then
SwingTrack1:Play(0.15)
SwingTrack1.Stopped:Wait()
Tool.Handle.Swing1:Play()
CanDamage = false;
Swing = true;
print("1")
wait(0.3)
Debounce.Value = false;
elseif Swing then
SwingTrack2:Play(0.15)
SwingTrack2.Stopped:Wait()
Tool.Handle.Swing2:Play()
CanDamage = false;
Swing = false;
print("2")
wait(0.3)
Debounce.Value = false;
end
end
Tool.Handle.Touched:Connect(function(hit)
if (hit.Parent:FindFirstChild("Humanoid")) and CanDamage and not (hit.Parent:FindFirstChild("Attacked")) then
CanDamage = false;
hit.Parent:FindFirstChild("Humanoid"):TakeDamage(20)
hit.Parent:FindFirstChild("Humanoid").BreakJointsOnDeath = false;
hit.Parent:FindFirstChild("Humanoid").RequiresNeck = false;
for _, v in pairs(hit.Parent:GetDescendants()) do
if v:IsA("Motor6D") then
local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
a0.CFrame = v.C0
a1.CFrame = v.C1
a0.Parent = v.Part0
a1.Parent = v.Part1
local b = Instance.new("BallSocketConstraint")
b.Attachment0 = a0
b.Attachment1 = a1
b.Parent = v.Parent
v.Enabled = false;
end
end
local KnockBack = Instance.new("BodyVelocity", hit.Parent:FindFirstChild("HumanoidRootPart"))
KnockBack.Velocity = 50 * Tool.Parent:FindFirstChild("HumanoidRootPart").CFrame.LookVector
KnockBack.MaxForce = Vector3.new(1, 1, 1) * 10000
Tool.Handle.Hit:Play()
Tool:WaitForChild("Physics"):FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))
wait(0.1)
KnockBack:Destroy()
wait(4.9)
for _, v in pairs(hit.Parent:GetDescendants()) do
if v:IsA('Motor6D') then
v.Enabled = true
end
if v.Name == "BallSocketConstraint" then
v:Destroy()
end
if v.Name == "Attachment" then
v:Destroy()
end
end
hit.Parent:FindFirstChild("Humanoid").BreakJointsOnDeath = true;
hit.Parent:FindFirstChild("Humanoid").RequiresNeck = true;
end
end)
end)
Client Script:
local Tool = script.Parent
Tool:WaitForChild("Physics").OnClientEvent:Connect(function(Player)
print("Fired")
local Character = Player.Character or Player.CharacterAdded:Wait()
Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
Character:WaitForChild("Humanoid"):ChangeState(Enum.HumanoidStateType.Ragdoll)
wait(4.9)
Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
Character:WaitForChild("Humanoid"):ChangeState(Enum.HumanoidStateType.Ragdoll)
end)
So there’s two things I noticed, first, changing the other players state on the client side won’t work. Second, the firing to the client is not working.
A thing I tried was changing the state of the humanoid server sided, but this didn’t work.
So, here I am, asking the DevForums what to do. If you have any idea, please reply. Thanks