Players not Teleporting

Ok so basically, I was fixing this bugs and then the teleport doesn’t work anymore all of a sudden. It worked in studio, but when i went to the actual game, it didn’t teleport me. There were no errors in output or script analysis. Heres the script: (Everything else before teleport works well)

game.Workspace.Sound1:Play()
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(currenttime)
script.Parent.Text = "Welcome! A new map will be chosen in ".. tostring(currenttime)
wait(30)
script.Parent.Text = "Map: New York 2056"
wait(2)
script.Parent.Text = "Teleporting to map.."
wait(1)
script.Parent.Text = "Teleporting to map..."
wait(1)
game.Workspace.Sound1:Stop()
wait(1)
game.Lighting.Map2.Parent = game.Workspace
if script.Parent.Text == "Teleporting to map..." then
for _, player in pairs (game.Players:GetChildren()) do
    local char = player.Character
    char.HumanoidRootPart.CFrame = game.Workspace.Map2.Map2SpawnPoint.CFrame

Go see for yourself: Sword Fights 'Round in Progress' (Coming Soon) - Roblox

Are you attempting to teleport players client-side? It must be done server-side.

It worked on this script but then i fixed a bug and then this didn’t work anymore

Was the bug related to this code if so then what exactly?

I don’t know how to help because I don’t understand your question very well, but I have some things to say about your script:

  1. so many arbritray wait()s, why. You’re making your players wait for like 40 seconds for no reason at all.
  2. it waits 30 seconds, promising a random map and then just “chooses” "New York 2056"?.
  3. It says "Teleporting to map..", waits 1 second and then adds another dot to the end of the string? Then it waits another 2 seconds before it actually starts teleporting you to the map.
  4. You can’t teleport players clientside because this game has FilteringEnabled on by default!

please avoid using magic values. this script literally looks like you’re trying to make as clunky and slow experience as humanly possible. It’s like the joke where you add arbitrary waits to your program and then update the values and say you worked hard to optimize and make the program more performant.