I made a game script but the players don't get teleported to game? Please help! The script is the part that doesn't work. Code doesn't get executed after the teleport script
local MapList = Maps:GetChildren()
local SelectedIndex = math.random(1,#MapList)
local ChosenMap = MapList[SelectedIndex]:Clone()
ChosenMap.Parent = workspace
wait(10)
Sheriffs = Players:GetPlayers() -- Gets all sheriffs
local PlayerIndex = math.random(1,#Sheriffs)
local JuggernautPlr = Sheriffs[PlayerIndex]
table.remove(Sheriffs,findIndex(Sheriffs,JuggernautPlr))
for i,v in pairs(Sheriffs) do
local NewGun = Gun:Clone()
NewGun.Parent = v.Backpack
local GameTag = Instance.new("StringValue") -- Used to see if they are in game
GameTag.Name = "GameTag"
GameTag.Parent = v.Character
local Humanoid = v.Character:WaitForChild("Humanoid")
local SpawnIndex = math.random(1,#AllSpawns)
local ChosenSpawn = AllSpawns[SpawnIndex]
Humanoid:MoveTo(ChosenSpawn.Position+Vector3.new(0,3,0)) -- This doesn't work!
table.remove(AllSpawns,findIndex(AllSpawns,ChosenSpawn))
end

5 comments
Is it in a local script or a normal script?
normal script
Do not use :MoveTo(), instead teleport the HumanoidRootPart to the area you want to go to, also add a +Vector3.new(0,5,0) so players don't get stuck.
Nope, still didn't work in game.
It works in studio, but in game it doesn't work.