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

Destroying a fire not working?

Asked by 7 years ago
Player= game.Players.LocalPlayer
Damage= game.ReplicatedStorage.Damage.Value 
effect= game.ReplicatedStorage.effect.Value
Fire= Instance.new("Fire")
Fire.Size=25

script.Parent.Touched:connect(function (hit)
    script.Parent.CanCollide=false
    script.Parent.Transparency=1
    local humanoid = hit.Parent:FindFirstChild("Humanoid")
    humanoid.Health = humanoid.Health - Damage

    Fire.Parent = humanoid.Torso

    if effect == ("fire") then

    Fire.Parent = humanoid.Torso
    for i= 5,0,-1 do
        hit.Parent.Humanoid:TakeDamage(10)
        wait(1)
    end
    Fire:Destroy()
    damage = false
    script.Parent:Destroy() 
    end
    end)

damage=true

So, let me explain. In my game, you shoot balls at others to inflict damage. This script goes under the actual ball that gets shot. There is a script in the starter pack that clones this ball, gives it velocity, etc.

anyways damage and effects are values. A will make a gui that changes the variables allowing for diffrent types of balls.

So, every thing works fine until "Fire:Destroy()".It won't go away.

Can you please fix the error?

0
if effect == ("fire") -- didn't you mean -- if effect == "fire" ? Programical 653 — 7y
2
There's no difference ^ RubenKan 3615 — 7y
0
Capitalize the "f" in fire in (if effect == ("fire")) GuestRealization 102 — 7y

1 answer

Log in to vote
0
Answered by
Prestory 1395 Moderation Voter
7 years ago

You cant locate it like that try using this you can try setting it false like i did below tell me if it helped.

Player= game.Players.LocalPlayer
Damage= game.ReplicatedStorage.Damage.Value 
effect= game.ReplicatedStorage.effect.Value
Fire= Instance.new("Fire")
Fire.Size=25

script.Parent.Touched:connect(function (hit)
    script.Parent.CanCollide=false
    script.Parent.Transparency=1
    local humanoid = hit.Parent:FindFirstChild("Humanoid")
    humanoid.Health = humanoid.Health - Damage

    Fire.Parent = humanoid.Torso

    if effect == ("fire") then

    Fire.Parent = humanoid.Torso
    for i= 5,0,-1 do
        hit.Parent.Humanoid:TakeDamage(10)
        wait(1)
    end
    Fire.Enabled = false
    damage = false
    script.Parent:Destroy() 
    end
    end)

damage=true


Ad

Answer this question