Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Destroying a fire not working?

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?

3 comments

0

if effect == ("fire") -- didn't you mean -- if effect == "fire" ?

2

There's no difference ^

0

Capitalize the "f" in fire in (if effect == ("fire"))

1 answer

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


This discussion is preserved as it was. New answers, comments, and votes are closed.