- What do you want to achieve? Keep it simple and clear!
I want to make so that when I slam someone they are moved to the ground, like in this video
- What is the issue? Include screenshots / videos if possible!
Legs are not letting the player to fall down which causing it not to move. I use raycast to detect the ground and AlignPosition to move it.
I also use AlignPosition for other moves too, which means that the issue is not AlignPosition.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried to use an attachment on the torso, cause when player ragdolls their humanoidrootpart join is disabled and humanoidrootpart and torso are connected afterwards. And it didn’t work, also uppercut is working perfectly fine without those changes. so it is definetly not that too.
Also, I was using LinearVelocity before, which worked fine, I wanted to change it to AlignPosition cause of it’s smoothness from all players perspective compared to linear velocity.
Here’s how ragdoller script looks like:
function Ragdoller(Value, Humanoid: Humanoid)
if Value then
Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
ReplaceJoints(Humanoid.Parent)
else
ResetJoints(Humanoid.Parent)
Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
end
end
local Ragdoll = {}
function Ragdoll:Ragdoll(Character: Model)
local HumanoidRootPart = Character.PrimaryPart
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
Humanoid.WalkSpeed = 0
Humanoid.JumpHeight = 0
Humanoid.AutoRotate = false
Humanoid.PlatformStand = true
HumanoidRootPart.CanCollide = false
HumanoidRootPart.Massless = true
HumanoidRootPart.RootJoint.Enabled = false
HumanoidRootPart.Parent:FindFirstChild("Left Leg").CanCollide = false
HumanoidRootPart.Parent:FindFirstChild("Right Leg").CanCollide = false
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = HumanoidRootPart
Weld.Part1 = HumanoidRootPart.Parent:FindFirstChild("Torso")
Weld.Name = "RagdollWeld"
Weld.Parent = HumanoidRootPart
if Players:GetPlayerFromCharacter(Character) then
HumanoidRootPart:SetNetworkOwner(nil)
end
Ragdoller(true, Humanoid)
end
And here is the mover:
local Attachment = Character.PrimaryPart:FindFirstChild("RootAttachment")
if not Attachment then return end
local AlignPosition = Instance.new("AlignPosition")
AlignPosition.Mode = Enum.PositionAlignmentMode.OneAttachment
AlignPosition.Attachment0 = Attachment
AlignPosition.ForceLimitMode = Enum.ForceLimitMode.PerAxis
AlignPosition.MaxAxesForce = Vector3.new((PunchType == "GroundSlam" or PunchType == "Uppercut") and 0 or 14000, (PunchType == "GroundSlam" or PunchType == "Uppercut") and 14000 or 100, (PunchType == "GroundSlam" or PunchType == "Uppercut") and 0 or 14000)
AlignPosition.Parent = Character.PrimaryPart
AlignPosition.Position = RaycastResult.Position
Debris:AddItem(AlignPosition, 0.3)