Help with initial spawn pos

Hi. I’m trying to put a player at the admin room for 10 seconds, then making them respawn at the original place after 10 seconds. I have this current script:
[lua]local PlayerSpawns = {
Vector(-4798.270020, -1354.281006, 584.031250),
Vector(-4717.218262, -1354.593262, 584.031250),
Vector(-4625.931641, -1354.945190, 584.031250),
Vector(-4623.518066, -1273.752563, 584.031250),
Vector(-4720.831055, -1270.956787, 584.031250),
Vector(-4807.355957, -1270.623291, 584.031250),
Vector(-4812.108887, -1209.230835, 584.031250),
Vector(-4731.321777, -1208.894531, 584.031250),
Vector(-4638.072754, -1209.254028, 584.031250),
Vector(-4636.528809, -1539.258545, 584.031250),
Vector(-4720.612793, -1542.270630, 584.031250)}

function RSOFix(ply)
ply:SetPos(PlayerSpawns[math.random(1, #PlayerSpawns)])
timer.Simple(1, function()
ply:Freeze( true )
ply:ChatPrint(“You will return to spawn in a few seconds, no worries.”)
ply:ChatPrint(“You will return to spawn in a few seconds, no worries.”)
ply:ChatPrint(“You will return to spawn in a few seconds, no worries.”)
ply:ChatPrint(“You will return to spawn in a few seconds, no worries.”)
end)
timer.Simple(10, function()
ply:Freeze( false )
ply:KillSilent()
end)
timer.Simple(11, function()
ply:Spawn()
ply:ChatPrint(“You have respawned.”)
end)
end
hook.Add(“PlayerInitialSpawn”, “PlayerInitialSpawn”, RSOFix)[/lua]

Everything works but the player spawn. It doesn’t spawn them in the admin room, it spawns where the main spawnpoint is. What am I doing wrong? I’m fairly new to Lua. I also don’t receive any errors

Use PlayerSpawn instead of PlayerInitialSpawn.

but I want to use initial spawn because I want the player to do this only once when he first joins.

So what you’re trying to do is on first spawn put them into the admin room then teleport back to spawn?

What folder did you put this in starting from the garrysmod folder.

Put the autorespawn.lua with the lua code inside it lua/autorun/server/autorespawn.lua

Restart server then try.

It is on the server. Just the spawning doesn’t work

Try using this?
[lua]ply:SetPos(table.Random(PlayerSpawns))[/lua]

Have you tried just doing ply:SetPos(PlayerSpawns[1]), because that would narrow it down, if it worked.

The code works fine for me.

I don’t know why it doesn’t work for me, I did exactly what you said.

Maybe you’re using the same
[lua]hook.Add(“PlayerInitialSpawn”, “PlayerInitialSpawn”,RSOFix)[/lua] Second hook name change to

[lua]hook.Add(“PlayerInitialSpawn”, “testspawn”,RSOFix)[/lua]

That should explain why it wasn’t working!!