Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

So i am making this fire ball blast, and i want it to avoid hitting the shooter, how do i fix it?

Asked by 4 years ago

So once you fire the attack and it hits the player that shot the attack, it breaks the damage script and doesn't work anymore, but if the fire attack doesn't hit the player that shot it, the script works perfectly, how do i fix it?

Script -

local Blast = script.Parent
local Explosion1 = Blast.Explosion1
local Explosion2 = Blast.Explosion2
local Explosion3 = Blast.Explosion3
local Explosion4 = Blast.Explosion4
local Bits = Blast.Bits
local Fire1 = Blast.Fire1
local Fire2 = Blast.Fire2
local Fire3 = Blast.Fire3
local Damage = script.Parent.Damage.Value
local BoolCheck = Blast:FindFirstChildOfClass("Vector3Value")
local Check = true
local BodyVelocity = Blast:FindFirstChild("BodyVelocity")
Blast.Touched:Connect(function(hit)
    if Check == true then
        Check = false
        local Humanoid = hit.Parent:FindFirstChild("Humanoid")
        if hit.Parent.Name ~= BoolCheck.Name then
        if Humanoid then print("Hit")
           if hit.Parent.Name == BoolCheck.Name then
            print("Hit Part is not the shooter")
            BodyVelocity.Velocity = Vector3.new(0,0,0)
            Explosion1.Enabled = true
            Explosion2.Enabled = true
            Explosion3.Enabled = true
            Explosion4.Enabled = true
            Bits.Enabled = false
            Fire1.Enabled = false
            Fire2.Enabled = false
            Fire3.Enabled = false
            Humanoid.Health = Humanoid.Health - Damage  
            wait(0.25)
            Explosion1.Enabled = false
            Explosion2.Enabled = false
            Explosion3.Enabled = false
            Explosion4.Enabled = false
            wait(1.5)
            Blast:Destroy()
            end
        if Humanoid == nil then
            BodyVelocity.Velocity = Vector3.new(0,0,0)
           Explosion1.Enabled = true
            Explosion2.Enabled = true
            Explosion3.Enabled = true
            Explosion4.Enabled = true
            Bits.Enabled = false
            Fire1.Enabled = false
            Fire2.Enabled = false
            Fire3.Enabled = false
            wait(0.25)
            Explosion1.Enabled = false
            Explosion2.Enabled = false
            Explosion3.Enabled = false
            Explosion4.Enabled = false
            wait(1.5)
            Blast:Destroy()
            end
            end
            end
        end
    end)

Answer this question