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

07:02:08.573 - Workspace.map:60: unexpected symbol near '?'?

Asked by 5 years ago
Edited 5 years ago

Error is on line 54

local players = game.Players:GetChildren()
local maps = game.Lighting:GetChildren()
local currentmap = game.Workspace:WaitForChild("CurrentMap")
local chosenmap = Script.Workspace:WaitForChild("ChosenMap")
local spawner = game.Workspace:WaitForChild("Spawn") 
local choices = {}

function chooseMap()
  for I=1,#maps do
    if maps[i]:isA("Model") then
        table.insert(choices,maps[i])
      end
   end
    local picked = math.random(1,#maps)
     chosenmap.Value = choices[picked].Name
   end

function loadMap()
   local map = gam.Lighting.Maps:FindFirstChild(chosenmap.Value)
   map:Clone().Parent = currentmap
 end

function deleteMap()
  for i,v in pairs(currentmap:GetChildren()) do
    if v:isA("Model") then
       v:Destroy()
     end
   end
end

function teleportPlayers()
  for i,v in pairs(players) do
    v.Character.HumanoidRootPart.CFrame = currentmap:FindFirstChild(chosenmap.Value).Spawn * CFrame.new(math.random(5,10),0,math.random(5,10))
  end
end

function teleportBack()
  for i,v in pairs(players) do
    v.Character.HumaniodRootPart.CFrame =
    spawner.SpawnLocation.CFrame *
    CFrame.new(math.random(5,10),0,math.random(5,10))
  end
end

while true do
 wait(3)
 chooseMap()
 loadMap()
 wait(1)
 teleportPlayers()
 wait(10)
 deleteMap()
 teleportBack()
end

I get this error in the output/console 07:02:08.573 - Workspace.map:60: unexpected symbol near '?'

What am I doing wrong here?

0
It errors because there's a random question mark after the 'end' on line 54 Rare_tendo 3000 — 5y
0
on line 54, why you type "?" (Question mark)? you don't need to type here. Mitumitu17YN -5 — 5y
0
that was never there in the original script, must of accidentally put that there while writing this question LoganboyInCO 150 — 5y
0
On lines 8, 18, 23, 31, 37 you're polluting the global namespace User#19524 175 — 5y
View all comments (2 more)
0
and how would I fix it? LoganboyInCO 150 — 5y
0
It should be local. Don't use global scoping, as it's not such a good practice. Lugical 425 — 5y

1 answer

Log in to vote
1
Answered by
Lugical 425 Moderation Voter
5 years ago

Simply put, the error is saying you put "?" out of nowhere, with no reasonable context. The error is saying unexpected symbol, meaning it wasn't meant to be there. Regardless of whether you say it wasn't from the original script, I'd advise you to check the script and get rid of a question if there is one.

All in all, make sure to check for any "grammatical" errors in your script.

local players = game.Players:GetChildren()
local maps = game.Lighting:GetChildren()
local currentmap = game.Workspace:WaitForChild("CurrentMap")
local chosenmap = Script.Workspace:WaitForChild("ChosenMap")
local spawner = game.Workspace:WaitForChild("Spawn") 
local choices = {}

function chooseMap()
  for I=1,#maps do
    if maps[i]:isA("Model") then
        table.insert(choices,maps[i])
      end
   end
    local picked = math.random(1,#maps)
     chosenmap.Value = choices[picked].Name
   end

function loadMap()
   local map = gam.Lighting.Maps:FindFirstChild(chosenmap.Value)
   map:Clone().Parent = currentmap
 end

function deleteMap()
  for i,v in pairs(currentmap:GetChildren()) do
    if v:isA("Model") then
       v:Destroy()
     end
   end
end

function teleportPlayers()
  for i,v in pairs(players) do
    v.Character.HumanoidRootPart.CFrame = currentmap:FindFirstChild(chosenmap.Value).Spawn * CFrame.new(math.random(5,10),0,math.random(5,10))
  end
end

function teleportBack()
  for i,v in pairs(players) do
    v.Character.HumaniodRootPart.CFrame =
    spawner.SpawnLocation.CFrame *
    CFrame.new(math.random(5,10),0,math.random(5,10))
  end
end

while true do
 wait(3)
 chooseMap()
 loadMap()
 wait(1)
 teleportPlayers()
 wait(10)
 deleteMap()
 teleportBack()
end -- Got rid of the question mark here.
0
the question mark was never there in the original script, I had already looked and it was not there, tested it and still doesnt work LoganboyInCO 150 — 5y
0
It says line 60, which you didn't post in your script. Check for errors in the line, cuz the error literally means there's an unexpected question mark on line 60. Lugical 425 — 5y
Ad

Answer this question