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

How to remove Fire from a player?

Asked by
Aozwel 71
4 years ago

Hey there, New scripter here.

I made this script when Touched the player goes on fire, However i'm trying to make the Fire disappear after a wait(5) put doesn't seem to be working?

Any ideas?

function lightOnFire(part)

    fire = Instance.new("Fire")
    fire.Parent = part
end

firePart = game.Workspace.FirePart
firePart.Touched:Connect(lightOnFire)

wait(5)
fire:Destroy()

Thanks,

2 answers

Log in to vote
1
Answered by 4 years ago

The other answer got downvoted so I assume it didn't work. Try this.

game.Workspace.FirePart.Touched:Connect(function(part)
    local fire = Instance.new("Fire")
    fire.Parent = part

    local Debris = game:GetService("Debris"):AddItem(fire, 5)
end)
Ad
Log in to vote
-2
Answered by
BashGuy10 384 Moderation Voter
4 years ago
Edited 4 years ago

Sup, i'm BashGuy10. I can help ye :)

Problem?

You can't remove the fire from the part.

Fixes

You should use:

firepart.Touched:Connect(function(part)
    -- Code
end)

Also, use the wait() and :Destroy() actions inside the Touched Event

Example Fix for Problem 2

firepart.Touched:Connect(function(part)
    -- Instance.new code here

    wait(5)
    fire:Destroy()
end)

Here have the answer since it is kinda confusing to you(btw im pretty sure your not allowed to spoon feed answers like MachoPiggies did)

local firepart = script.Parent

fire.Touched:Connect(function(part)
    local fire = Instance.new("Fire", workspace)

    wait(5)
    fire:Destroy()
end

0
AW COME ON, who downvoted. I just got that 2 rep back (insert sad emoji here) BashGuy10 384 — 4y
0
@BashGuy10 That didn't quite seem to work?, Im not totally sure what im meant to replace in my previous code Aozwel 71 — 4y

Answer this question