So if I understand correctly, the code doesn’t work while shift lock or first person is enabled?
I would try turning off AutoRotate while the character is being knocked back.
AutoRotate determines if first person or shift lock should rotate the character. While it is off everything works the exact same besides the character isn’t forced to face the direction of the camera.
So in your code, for example, set Humanoid.AutoRotate to false, then inside the function given to task.delay set Humanoid.AutoRotate to true (regularly auto rotate is always true, so you don’t need to check the initial state).
Another thing, you probably want to set the humanoid state to HumanoidStateType.Ragdoll. In the first video, you apply enough force to automatically change the state to ragdoll. In the second video, the first person/shift lock setting overrides your force, causing the player to not automatically go into the ragdoll state. It is probably a good idea to just set the state to ragdoll so you don’t need to worry about weird cases like this one.
Since you mentioned a system similar to Slap Battles, I would suggest using my Ragdoll 5.2 model, since it is fully compatible with R6.
Though, consider it a bandaid solution, since this model is quite outdated by now.
Ragdoll 5.2.rbxm (7.8 KB)
Please enable the script and put it into starter character scripts. You can then change some of the settings in the script itself. Disable some of them if they don’t work for you.
Then, to activate it, change the IsRagdollBoolValue to true. It will then ragdoll for a set amount of time specified in RagdollTime, parented inside the value.
Another solution is using stateChanger, a solution I made for the 2020 version of Ragdoll 6, but it still works today. This module will change the state of the humanoid until you tell it to stop doing so. It will also do so on the server and client.
To use the module, please require it. Use StateChanger.StartRagdoll and StateChanger.StopRagdoll to start and stop changing the state. This script will do so from the server and client, but you must remember to stop the state change or else the script will cause issues (the player can’t get up).
PlatformStand is a property of Humanoid that determines if the player “can’t get up”. I suggest setting it to true for about 2 seconds and then to false.
you can disable autorotate and disabled after ragdoll time
exemple:
spawn(function) --reduce the risk of having the camera disabled for longer
local human = char:findfirstchild(“Humanoid”) --get the humanoid
human.AutoRotate = false --get camera controll and disable
wait(ragdolltime) --wait ragdoll time
human.AutoRotate = true --enable camera controll
end)
if its not the problem
try to make ragdolltime = knockback, Y Vector
slap battles ragdoll use BallSocketConstraint
in bodyparts
and bodyvelocity is deprecated try to use VectorVelocity
you can disable moviment in ragdoll time
local FightUtils = {}
function FightUtils:knockBack(pChar, eChar, kB)
local debris = game:GetService("Debris")
local pHrp = pChar and pChar:FindFirstChild("HumanoidRootPart")
local eHrp = eChar and eChar:FindFirstChild("HumanoidRootPart")
if pHrp and eHrp then
local pPlr = game.Players:GetPlayerFromCharacter(pChar)
print("KB")
local force = Instance.new("BodyVelocity")
force.MaxForce = Vector3.new(10, 10, 10) * math.huge
force.Velocity = pHrp.CFrame.LookVector * kB + Vector3.new(0, kB/2, 0)
force.Parent = eHrp
if force then
debris:AddItem(force, 0.25)
end
local rot = Instance.new("BodyAngularVelocity")
rot.AngularVelocity = Vector3.one * math.pi * 2.5
rot.MaxTorque = Vector3.one * math.huge
rot.P = 10000
rot.Parent = eHrp
if rot then
debris:AddItem(rot, 0.25)
end
-- Apply ragdoll effect with BallSocketConstraints
local attachments = {}
for _, part in pairs(eChar:GetChildren()) do
if part:IsA("BasePart") and part ~= eHrp then
local attachment0 = Instance.new("Attachment")
attachment0.Parent = part
local attachment1 = Instance.new("Attachment")
attachment1.Parent = eHrp
local constraint = Instance.new("BallSocketConstraint")
constraint.Attachment0 = attachment0
constraint.Attachment1 = attachment1
constraint.LimitsEnabled = true
constraint.UpperAngle = 180
constraint.TwistLimitsEnabled = true
constraint.TwistUpperAngle = 180
constraint.TwistLowerAngle = -180
constraint.Parent = part
table.insert(attachments, attachment0)
table.insert(attachments, attachment1)
debris:AddItem(constraint, 0.25)
end
end
-- Disable movement during ragdoll time
local humanoid = eChar:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.PlatformStand = true
end
-- Re-enable movement after ragdoll time
task.wait(0.25)
if humanoid then
humanoid.PlatformStand = false
end
-- Destroy attachments after ragdoll effect
for _, attachment in pairs(attachments) do
if attachment and attachment.Parent then
attachment:Destroy()
end
end
end
end
return FightUtils
Yeah,But you need disable character joints in ragdoll and enabled after,And you need a LocalScript changing the humanoid state for pyshical and after ragdoll gettingup, YOU NEED DISABLE AUTOROTATE and if its dont work try to disable mobile shiftlock when is ragdoll and enabled again