Making this script only work for a specific team.

Hi there.
I am trying to make a script that i fixed for gmod 13 work for only 2 specific teams in DarkRP. I have tried 2 different methods. The first being:

[lua]
if ( ply:Team() == TEAM_RUNNER or ply:Team() == TEAM_PRUNNER ) then
–do the script
end
[/lua]

and i’ve also tried putting this in the beggining of each function:
[lua]
if !( ply:Team() == TEAM_RUNNER or ply:Team() == TEAM_PRUNNER ) then return end
[/lua]

But when i send them to my friend, he claims it doesn’t work for anyone. (however not putting those lines makes the script work, but for everyone)

Here is the script i’m trying to add this to. This is just for reference.

Any ideas?

Bump.

Line 312
[lua]
function ParkourThink()
if ( ply:Team() == TEAM_RUNNER or ply:Team() == TEAM_PRUNNER ) then --When changing this, remember to take out the “end” statment for this
for k, v in pairs(player.GetAll()) do
[/lua]

This won’t work since the player var hasn’t been initialized. Change it to:

[lua]
function ParkourThink()
for k, v in pairs(player.GetAll()) do
if !( v:Team() == TEAM_RUNNER or v:Team() == TEAM_PRUNNER ) then return end
[/lua]

Worked, thanks!