So, my issue is that the knockback system in my script works fine when I test it out on dummies. But it never works on actual players. I haven’t really found any issue similar. I’ve tried changing the velocity of the target. The rag doll also stands mid air while standing still.
Script:
local touched = false
local TS = game:GetService("TweenService")
game.ReplicatedStorage.Throw.OnServerEvent:Connect(function(plr, mouseHit)
plr.Character.Humanoid:LoadAnimation(script.Parent.Handle:FindFirstChild("Yeet")):Play()
local clone = plr.Character:FindFirstChildWhichIsA("Tool").Handle:Clone()
clone.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent ~= plr.Character then
if not touched then
local target = hit.Parent
local joints = target:GetDescendants()
target.Humanoid.BreakJointsOnDeath = false
touched = true
clone.CanTouch = false
target.HumanoidRootPart.Velocity = plr.Character.HumanoidRootPart.CFrame.LookVector * 800 + Vector3.new(0,800,0)
clone.Impact:Play()
print(hit.Parent.Name,"was hit by",script.Parent.Name)
hit.Parent:FindFirstChild("Humanoid").Health -= 10
for _,joint in pairs(joints) do
if joint:isA("Motor6D") then
local socket = Instance.new("BallSocketConstraint")
local att0 = Instance.new("Attachment")
local att1 = Instance.new("Attachment")
print(joint)
target.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
target.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
target.Humanoid.AutoRotate = false
target.Humanoid.WalkSpeed = 0
target.Humanoid.JumpPower = 0
att0.Name = "Att0"
att1.Name = "Att1"
att0.CFrame = joint.C0
att1.CFrame = joint.C1
att0.Parent = joint.Part0
att1.Parent = joint.Part1
touched = true
clone.CanTouch = false
socket.Parent = joint.Part0
socket.Attachment0 = att0
socket.Attachment1 = att1
att0.Name = "Att0"
att1.Name = "Att1"
socket.LimitsEnabled = true
socket.TwistLimitsEnabled = true
--wait(0.2)
--wait(2)
joint.Enabled = false
end
end
if target.Humanoid.Health > 0 then
wait(0.2)
clone:Destroy()
touched = false
clone.CanTouch = true
wait(1)
target.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
target.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
target.Humanoid.AutoRotate = true
target.Humanoid.WalkSpeed = 26
target.Humanoid.JumpPower = 7.5
for _,joint2nd in pairs(joints) do
if joint2nd:isA("Motor6D") then
joint2nd.Enabled = true
end
end
for _, child in pairs(target:GetDescendants()) do
if child.Name == "Att0" or child.Name == "Att1" or child:IsA("BallSocketConstraint") then
child:Destroy()
end
end
end
end
end
end)
wait(0.4)
plr.Character:FindFirstChildWhichIsA("Tool").Handle.Woosh:Play()
wait(0.1)
plr.Character:FindFirstChildWhichIsA("Tool").Handle.Transparency = 1
print(clone.Parent)
clone.Parent = game.Workspace
-- clone.Position = script.Parent.Handle.Position
clone.Anchored = true
clone.CanTouch = true
clone.CanCollide = true
clone.CFrame = plr.Character.HumanoidRootPart.CFrame+plr.Character.HumanoidRootPart.CFrame.LookVector * 5
local Tween = TS:Create(clone,TweenInfo.new(0.5),{CFrame = plr.Character.HumanoidRootPart.CFrame + plr.Character.HumanoidRootPart.CFrame.LookVector * 80})
Tween:Play()
--print(mouseHit)
wait(0.45)
plr.Character:FindFirstChildWhichIsA("Tool").Handle.Transparency = 0
clone:Destroy()
end)
--clone.Touched:Connect(function(hit)
--local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
--print(plr,"was hit by",script.Parent.Name)
--end)```