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

I am trying to make the fireball not damage the player that shot 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:FindFirstChild("BoolCheck")
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 Humanoid then print("Hit")
            if BoolCheck.Value ~= hit.Parent.Name then
            if BoolCheck.Value == hit.Parent.Name then
            BodyVelocity.Velocity = Vector3.new(0,0,0)
            Blast.Anchored = true
            print("Hit Part is not the shooter")
            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
            end
            end
    end
    end)
0
Use an if then statement to make sure the Humanoid does not belong to the person who is firing the weapon. If it belongs to someone else, then do damage. EzraNehemiah_TF2 3552 — 4y
0
i think i did that XxGhostBoy_HDxX 38 — 4y
0
and i think that will still stop the blast, so it wont damage the shooter, but it will explode in his face XxGhostBoy_HDxX 38 — 4y
0
You only checked if the humanoid exists on line 18. You didn't check who the humanoid belongs to anywhere in this script. EzraNehemiah_TF2 3552 — 4y
0
ohh XxGhostBoy_HDxX 38 — 4y

Answer this question