Weird problem in involving other players

I have a teleporting system in my game, which works just fine in single player. But when I try it out in multiplayer any other person on the server gets the error: “includes/extensions/player.lua:147: attempt to call method ‘UniqueID’ (a nil value)”. whereas I am able to teleport around perfectly fine.

In my shared.lua I have this:
[lua]function Teleport_z(ply, command, args)
ply:SetPos(Vector(ply:GetPos().x, ply:GetPos().y, args[1]))

local vPoint = ply:GetShootPos()
local effectdata = EffectData()
effectdata:SetStart( vPoint )
effectdata:SetOrigin( vPoint )
effectdata:SetScale( 1000 )
util.Effect( “BloodImpact”, effectdata )
util.Effect( “cball_explode”, effectdata )
util.Effect( “RPGShotDown”, effectdata)
end
concommand.Add(“Teleport_z”, Teleport_z)[/lua]

Now the weird thing is that the effects stuff works perfectly fine, the sounds and effects show up exactly where they should be, but the character does not move to where the effects are, instead the other players gets the error mentioned earlier. This also happens when I try to use the ply:SetPData command as well, which is also in my shared.lua file. But whenever I try to set any player data etc. I just get that same error, well the other player on the server does.

I am still able to teleport perfectly fine without error though. I see no reason why this should not work, as well as use commands such as pl:PrintMessage.

Am I calling player wrong or anything, or is there a special way to call the player so you can set data?

I have tried searching all over the wiki and forums to find a solution to no avail.

Cheers in advance.

I am not positive because you don’t have enough information but this should not be in “shared.lua” because this should all be run server-side.

Do you have this in an addon, gamemode, or the lua folder?

if SERVER then – The code that includes the serverside functions, like pl:UniqueID()

if CLIENT then – The clientside stuff.

This is all part of my Gamemode. When I tried putting everything in the init.lua (which I am assuming is all the server side stuff) Players still get the same error.