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,
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)
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