So, basically a run down, I created a value in player that assigns a string value to how ever many players there is in the game, for example when there is 3 people in the game, whenever a new player joins, the string will automatically be changed to "Player 4". I also have spawn locations that are named from "Player 1" to "Player 7", and if the string value matches the name of one of the spawn locations, that player would be spawned to that specific spawn brick. Thats the problem: the character won't spawn to the brick. Any help? Normal server script in server script service:
game.Players.PlayerAdded:Connect(function(player)
local playernum = Instance.new("StringValue")
playernum.Parent = player
playernum.Name = "Player"
local players = game.Players:GetPlayers()
for _, v in pairs(players) do
playernum.Value = "Player "..#players
end
player.CharacterAdded:Connect(function(char)
local humanoid = char:WaitForChild("Humanoid")
local lowertorso = char:WaitForChild("LowerTorso")
local spawnlocations = game.Workspace:WaitForChild("BloxopolyBoard"):WaitForChild("SpawnLocations"):GetChildren()
if humanoid and lowertorso then
for _, v in pairs(spawnlocations) do
if playernum.Value == v.Name then
lowertorso.CFrame = CFrame.new(v.Name.Position)
end
end
end
end)
end)
With no changes i get the error: ServerScriptService.Script:16: bad argument #1 to 'new' (Vector3 expected, got nil)

1 comment
v.Position, not v.Name.Position. Strings don't have a Position property, and it didn't work for that reason.