Entity:Ignite does not work

I´ve made this function to ignite all players for 20 seconds. But it doesn´t work. Here is the Code:

[lua] function ignite()
for w, u in pairs(player.GetAll()) do
if u:IsPlayer() and u:Alive() then
u:Ignite( 20 )
end
end
end [/lua]

I cannot see the mistake.

It’s working for me, you might not be calling it

Also if you’re doing player.GetAll(), you already know all it values will be players, you don’t need to check it

Alright. Thanks. I will try. Maybe there is another mistake in my code

When you run into issues like this, just add a bunch of print statements to see what’s happening with your program:

[LUA]function ignite()
print( “Running ignite function” )
for w, u in pairs(player.GetAll()) do
print( "Running for player: " … tostring( u ) )
print( "IsPlayer: " … u:IsPlayer() )
print( "IsAlive: " … u:Alive() )
if u:IsPlayer() and u:Alive() then
print( “Igniting player” )
u:Ignite( 20 )
end
end
end[/LUA]

Running that should allow you to see exactly what’s going wrong.

Are you running the code serverside or clientside?
You would have to run this piece of code serverside due to ENTITY:Ignite being a serversided function.

Yes. It runs serverside. But I found the problem. I tried to run the function in the function of a “timer.Create”.