Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

In my game script, I coded for players to teleport to chosen map but the players aren't teleporting?

Asked by 7 years ago

In my game script of my minigame, the players should go to the map which is chosen randomly, however when I test the game it says "Teleporting Players" however the players aren't being teleported. Is there and error on my gamescript?

My GameScript:

001local maps = game.ServerStorage:WaitForChild("Maps"):GetChildren()
002local lobby = game.Workspace:WaitForChild("Lobby")
003local message = game.Workspace:WaitForChild("Message")
004local numplayers = game.Workspace:WaitForChild("NumPlayers")
005local chosenmap= game.Workspace:WaitForChild("ChosenMap")
006local selected = game.Workspace:WaitForChild("SelectedMap")
007local timer = game.Workspace:WaitForChild("Timer")
008local playerNeeded = 1 -- for testing :P
009local winners = {}
010function deleteLastMap()
011    selected:ClearAllChildren()
012end
013 
014function checkPlayers()
015    if numplayers.Value >= playerNeeded then
View all 205 lines...

Teleporting script in game script:

01function startGame()
02    local mapSpawn = selected:FindFirstChild(chosenmap.Value).Spawns:GetChildren()
03    local lobbySpawn = game.Workspace.Lobby:GetChildren()
04    local players = game.Players:GetPlayers()
05 
06    message.Value = "Teleporting Players..."
07    wait(1)
08 
09 
10    for i = 1,#players do
11        if players[i] ~= nil then
12            if players [1].Settings.AFK.Value~=false then
13                if players[i].Character ~= false then
14                    if players[i].Character.Humanoid.Health~=0 then
15                        local ransp =mapSpawn[math.random(1,#mapSpawn)].CFrame + Vector3.new(0,3,0)
View all 34 lines...

Are there any errors in the code which is stopping my player from teleporting. When I tested the game everything worked, just that the players didn't teleport to the map which was cloned/

Thank You and Help is appreciated

0
Line 12 of the bottom script has Players[1] instead of [i] RubenKan 3615 — 7y
0
still not teleporting? aspiringstar346 8 — 7y
0
First of all, we should be asking YOU if there are any errors. Also, no one will read 215 lines of code. Show relevant parts. hiimgoodpack 2009 — 7y
0
i did aspiringstar346 8 — 7y
View all comments (7 more)
0
the teleportation script aspiringstar346 8 — 7y
0
it says playing is not a valid member of folder on line 29 idk how to fix it aspiringstar346 8 — 7y
0
That means you havent created an instance with the name Playing in your Settings folder. RubenKan 3615 — 7y
0
also, is this a free model? RubenKan 3615 — 7y
0
What do you mean free model aspiringstar346 8 — 7y
0
as in a free model minigame script RubenKan 3615 — 7y
0
no aspiringstar346 8 — 7y

Answer this question