Me and some friends are making. a game, and our testing session is tomorrow, and to teleport all the players, I made this script. But it doesn't seem to be working. No one is getting teleported

Normal script

local check = "!minigame"
function onChatted(msg, recipient, speaker)
	local source = string.lower(speaker.Name)
	msg = string.lower(msg)
	if (msg == check) then
		print("here1")
		local Players = game:GetService("Players")
		local spawns = workspace.Spawns:WaitForChild("Tele")
		for i, player in pairs(Players:GetPlayers()) do
			print("in for")
			local body = player.Character:WaitForChild("LowerTorso")
			body.CFrame = spawns.CFrame
		end
	end
end

function onPlayerEntered(newPlayer)
	newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) 		end)
end

game.Players.PlayerAdded:connect(onPlayerEntered)

I can only get the 'print("here1")' to work, and I don't get a "in for". I'm really tired, as I did this late in night, so if you see any mistakes, please let me know :)

Thanks in advance

2 comments

0

Are you sure this is Server Script Service? because I just pasted your script into a test place I have and it worked just fine

0

Oh! I fixed this, thanks for letting me know :)