I have a very basic script that teleports players to a specific Vector3 position as seen here:
if player.Character then
player.Character:MoveTo(Vector3.new(5,5,5))
end
What I am trying to do, but cannot figure out, is how to have a more generalized Vector3 value so that the position will change based on which map is loaded and where the part "Spawn" is in that map. My attempt at the solution:
Maps = game.ReplicatedStorage.Maps:GetChildren() --Gets the map
Spawn = Maps.Spawn.Value.Value --Vector3Value parented to a part called "Spawn"
if player.Character then
player.Character:MoveTo(Vector3.new(Spawn)) --Attempt to use the Vector3 value
end
I get an error as a result of running the code above which says "attempt to index field 'Spawn' (a nil value). Is there something I am doing wrong?

4 comments
It's because you're trying to find what the script thinks is an index value Spawn in the Maps variable. Is there just one spawn, or are there multiple spawns?
There is just one spawn at the moment.
So, you intend on adding more?
Yes. I intend on making teams in the future, and each team will need a spawn location on each map.