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?
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