"SetTeam" is a nil value?

I’m trying to make a command that puts on you on Team Red (1), but it appears that the “SetTeam” value doesn’t exist?

Here is my code:


function JoinRed(ply)
    ply:SetTeam(1)
end
concommand.Add("join_red", JoinRed)

Here is my error:


[ERROR] gamemodes/test/gamemode/cl_init.lua:65: attempt to call method 'SetTeam' (a nil value)
  1. unknown - gamemodes/test/gamemode/cl_init.lua:65
   2. unknown - lua/includes/modules/concommand.lua:69

Any tips? I’m very very new to lua.

The Player:SetTeam() function doesn’t exist on the client, only on the server.

SetTeam is a server-side command. make sure you put it in a server file. -edit-Looks like I left the window open too long.

This has appeared to fix it. :downs:

Thank you both, I appreciate the help.