I am making a grab kick for my air combos, but this requires the enemy to be welded to the player. Problem is, if the enemy dies, player does too. Is there any solutions for this?
I have tried welding a part to the player, then setting the enemy CFrame, but this causes the enemy to lag behind due to client-server delay.
I was thinking about calculating the place they would travel to, then CFrame them there with the enemy instead of using a BodyVelocity, but I dont know how to do this.
Script:
local bv = Instance.new("BodyVelocity"); bv.Velocity = Char.HumanoidRootPart.CFrame.LookVector*30.5+Vector3.new(0,-10,0); bv.Parent = Char:WaitForChild("HumanoidRootPart");
for i = 1, 70 do
ClientFX:FireAllClients("ShadowPlayer", {
Character = Char,
Dura = .4
})
local Parts = Weapons.NewHitbox(Char["Left Leg"].CFrame * CFrame.new(0,-.5,-1), Vector3.new(2,4,3))
for _, Part in next, Parts do
local Victim = Weapons:CheckPartIsLimb(Part)
if Victim and hit[Victim] == nil and Victim ~= Char then
hit[Victim] = true
Victim:SetAttribute("Freeze", 1); Victim:SetAttribute("Stun", 1); Victim:SetAttribute("AutoRotate", Victim:GetAttribute("AutoRotate") + 1)
for i,v in pairs(Victim:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
if not NPC then
v:SetNetworkOwner(Player)
end
v.CollisionGroupId = 1
v.Massless = true
end
end
local Weld = script.TorsoToHum:Clone(); Weld.Part0 = Char.Torso; Weld.Part1 = Victim.HumanoidRootPart
Weld.Parent = Victim.HumanoidRootPart
Victim:WaitForChild("Humanoid"):LoadAnimation(game.ServerStorage.ClassAnims.Fists.AirVictim):Play()
end
end
for i,v in pairs(hit) do
table.insert(ign, i)
end
local raycastparams = RaycastParams.new(); raycastparams.FilterType = Enum.RaycastFilterType.Blacklist; raycastparams.FilterDescendantsInstances = {Char,ign, workspace.Ignore}
local ray = workspace:Raycast(Char.HumanoidRootPart.Position, Vector3.new(0,-5.5,0), raycastparams)
if ray then
print(ray)
for i,v in pairs(hit) do
if i.HumanoidRootPart:FindFirstChild("TorsoToHum") then
i.HumanoidRootPart.TorsoToHum:Destroy()
end
local EnemyPlayer, EnemyNPC = Weapons:PlayerNPCCheck(i);
for i,e in pairs(i:GetDescendants()) do
if e:IsA("BasePart") or e:IsA("MeshPart") then
e.CollisionGroupId = 0
e.Massless = false
end
end
end
break end
task.wait(.1)
end