Sometimes my pushback script just kills the player, Chat GPT says that physics can kill, but doesn’t know to tell me how I can 100% prevent it, is there any way? Here is my code:
if Information.PushForce then
local Header = 1
if SpellName == "FLIPENDO" then
Header = -1
end
PushStun = MakeTag("Stun", TargetCharacter)
Functions.Movement(TargetPlayer, TargetHumanoid, nil, true)
if TargetHRP.Anchored == false then
TargetHRP.Anchored = true
if Information.AntiRagdoll then
Functions.Ragdoll(TargetCharacter, false)
elseif not TargetCharacter:FindFirstChild("AntiRagdoll") then
Functions.Ragdoll(TargetCharacter, true)
end
TargetHRP.CFrame = CFrame.new(TargetHRP.Position, Vector3.new(CasterPosition.X, TargetHRP.Position.Y, CasterPosition.Z)) * CFrame.fromOrientation(-Header * math.pi / 8, 0, 0)
TargetHRP.AssemblyLinearVelocity = CFrame.new(TargetHRP.Position, CasterPosition).LookVector * -Information.PushForce
local Connection
Connection = RunService.Heartbeat:Connect(function()
local Result = workspace:Raycast(TargetHRP.Position, Vector3.new(0, -100, 0), RaycastParams.new())
if Result ~= nil and Result.Position.Y - TargetHRP.Position.Y < 2 then
Connection:Disconnect()
Connection = nil
Functions.Ragdoll(TargetCharacter, false)
end
end)
TargetHRP.Anchored = false
end
end