generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Help me with my teleportation thingy

Previous Thread :: Next Thread 
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
19 Dec 2016 08:46 PM
I am making a script for my round based game, and it chooses rounds and it teleports players to the round, but every time I run it I get this error. "21:44:44.784 - Workspace.Script:24: attempt to index field '?' (a nil value)" Please help! Here is my code.

----------------------------------------------------------------------------------------------------

local h = Instance.new("StringValue",game.ReplicatedStorage)
h.Name = "MapChanged"
local maps = game.Lighting.Maps:GetChildren()
while true do
if game.Players.NumPlayers >= 0 then
h.Value = "Choosing Map..."
wait(3)

local randomMap = math.random(1, #maps)
local mapChosen = maps[randomMap]
local mapChosen = maps[randomMap]
h.Value = "Map Chosen: " ..mapChosen.Name
wait(3)
local mapChosenClone = mapChosen:Clone()
mapChosenClone.Parent = game.Workspace
--teleporting the players
local spawns = mapChosenClone.SpawnLocation:GetChildren()
for i, v in pairs(game.Players:GetPlayers()) do
local name = v.Name
local check = game.Workspace:FindFirstChild(name)
if check then
local humanoid = check:FindFirstChild("Humanoid")
if humanoid then
check:MoveTo(spawns[i].Position)

end
end

end




for i = 70, 1, -1 do
h.Value = "Tsunami in progress!"

wait(1)
end
h.Value = "Game ended!"
wait(3)
mapChosenClone:Destroy()
else
h.Value = "ERROR"
end
wait(.1)
end

--------------------------------------------------------------------------------------------------

Please put suggestions in the replies section. Thanks!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image