im working on a copy of a game, I have an ability that works as a 2 part counter, 1 hit for the initial stun, and a 2nd for damage, However, i have an another ability that clones yourself into an NPC that fights for you, it can be destroyed in 2 hits, since the counter counts as 2 hits, it will instantly destroy the clone, except after it is destroyed the script will keep infinitely Cframe your character up over and over.
i assumed it has something to do with the HumanoidRootPart in the clone no longer existing after being destroyed so its infinitely checking for it but cant find it. I’v attempted to fix it by checking if the humanoid you hit still exist, but I don’t think i did it right/Don’t know if its the best way to solve it. Would love some directions
elseif hitchar.Effects:FindFirstChild("SwiftEscape") then
if element == "Tai" then
local FlipAnim = hitchar.Humanoid:LoadAnimation(script.SwiftEscape.Flip)
local ShadowCon
if hitchar.HumanoidRootPart:FindFirstChild("AirComboVel") then
hitchar.HumanoidRootPart:FindFirstChild("AirComboVel"):Destroy()
end
InvisChar(hitchar, nil)
local DestroyLater = {}
local attacking = Instance.new("BoolValue", hitchar.Effects)
attacking.Name = "Attacking"
table.insert(DestroyLater,attacking)
local SuperArmor = Instance.new("Folder", hitchar.Effects)
SuperArmor.Name = "SuperArmor"
table.insert(DestroyLater,SuperArmor)
local attacking2 = Instance.new("BoolValue", hitchar.Effects)
attacking2.Name = "iFrame"
table.insert(DestroyLater,attacking2)
local speed = Instance.new("IntValue", hitchar.Effects)
speed.Name = "Speed"
speed.Value = -99999
table.insert(DestroyLater,speed)
local jump = Instance.new("IntValue", hitchar.Effects)
jump.Name = "Jump"
jump.Value = -99999
table.insert(DestroyLater,jump)
module.damage(hitchar,character,{
element = "Tai",
typee = "Blunt",
damage = .3,
stun = .4,})
local Animation = hitchar.Humanoid:LoadAnimation(script.SwiftEscape.GroundSlam) :: Animation
Animation:Play()
Animation:AdjustSpeed(1.8)
local vel = Instance.new("BodyVelocity")
vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
vel.Velocity = character.HumanoidRootPart.CFrame.lookVector * -10 + Vector3.new(0, 25 ,0)
table.insert(DestroyLater, vel)
local s = script.SwiftEscape.Escape:Clone()
s.Parent = hitchar.Head
s.Playing = true
game.Debris:AddItem(s, 2)
local Flash = script.SwiftEscape.ParticleEmitter2:Clone()
Flash.Parent = hitchar.HumanoidRootPart
Flash:Emit(5)
game.Debris:AddItem(Flash, 2)
Animation:GetMarkerReachedSignal("Slam"):Connect(function()
Uninvis()
local SwiftEscapefx = script.SwiftEscape["Swift Esc"]:Clone()
SwiftEscapefx.Parent = workspace.Effects
SwiftEscapefx:PivotTo(character.HumanoidRootPart.CFrame * CFrame.new(0,-1.5,0) * CFrame.Angles(math.rad(-90),0,0))
SwiftEscapefx.RoughShockwaveElectricity.handleeffect2.Enabled = true
local smash = script.SwiftEscape.smash:Clone()
smash.Parent = workspace
smash.Position = character.HumanoidRootPart.Position
smash.Attachment.ParticleEmitter:Emit(30)
smash.Attachment2.ParticleEmitter2:Emit(100)
game.Debris:AddItem(smash, 3)
hitchar.HumanoidRootPart.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0,5,0)
module.damage(hitchar,character,{element = "Tai",
typee = "Blunt",
damage = 15,
stun = 2,
speed = -7,
knockback = nil,
knockbackduration = 0.15,
blockable = true,
blockbreak = false,
behind = false,
customanim = nil,
subbable = true,})
FlipAnim:Play()
spawn(function()
ShadowCon = game["Run Service"].Heartbeat:Connect(function()
ShadowClone(hitchar)
end)
end)
vel.Parent = hitchar.HumanoidRootPart
InvisChar(hitchar,nil)
end)
Animation:GetMarkerReachedSignal("End"):Connect(function()
FlipAnim:Stop()
Uninvis()
ShadowCon:Disconnect()
for i,v in pairs(DestroyLater) do
v:Destroy()
end
end)
return getReturnInfo()
end
end
end