So I've been trying to get this to work for hours and it just won't. I'm trying to send whatever player is in queue[2] to another place, but it says it's nil, meanwhile the localscript has no problem seeing the player's id in queue[2]. I'm so confused.
Important things in Modulescript:
local queue = {} --Line 3 table.insert(queue,1,0) --Line 4 function module_MM.add(playerId) --line 8 table.insert(queue, playerId) --line 9 end --line 10 game:GetService('TeleportService'):Teleport(newPlaceId, queue[2]) --line 28 function module_MM.firstPlayer() --line 44 return queue[2] --line 45 end --line 46
Important things in localscript:
player = game.Players.LocalPlayer --line 1 local Matchmaking = require(workspace.MatchMaking) --line 2 Matchmaking.add(player.UserId) --line 15
Important things in script that sends players away:
local Matchmaking = require(workspace.MatchMaking) --line 1 --the following inside a while true do loop player = Matchmaking.firstPlayer() --line 6 local getId = game:GetService("Players"):GetPlayerByUserId(player) --line 24 if game.Players:FindFirstChild(tostring(getId)) ~= nil then --line 23 Matchmaking.teleport() --line 22 end --line 21
Edit: Works in studio (Though it obviously can't create a place there)