game:GetService("Players").PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
char:FindFirstChild("HumanoidRootPart").CFrame = SpawnValues[math.random(1, #SpawnValues)]
end)
end)
(SpawnValues is a table with the cframes of certain parts I want the player to spawn at) This script works fine in roblox studio, but in game it doesn't work? I don't want to use a spawnlocation part since I want the player when they join to spawn in the lobby, then later for them to spawn somewhere else.

2 comments
Make sure that this is in a server script, not a localscript.
Yep, it's in a server script