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
 

Re: Please help with script!

Previous Thread :: Next Thread 
Armeraivis is not online. Armeraivis
Joined: 21 May 2014
Total Posts: 1
26 Oct 2017 08:11 AM
Making a game where players get teleported in a map taken from serverstorage (map has spawns in it but character doesnt want to teleport there)
Script:


wait(3)
local spawns = chosenmap:FindFirstChild('Spawns'):GetChildren()
for _, player in pairs(game.Players:GetPlayers()) do
if player and #spawns > 0 then
local torso = player.Character:WaitForChild('Torso')
local allspawns = math.random(1, #spawns)
local randomspawn = spawns[allspawns]
if randomspawn and torso then
table.remove(spawns, allspawns)
head.CFrame = CFrame.new(randomspawns.Position + Vector3.new(0, 2, 0))
end
end
end
end

(just a fragment of the script that causes errors)

*There is an error in 2nd line: "ServerScriptService.MainScript:21: attempt to index global 'chosenmap' (a nil value)"
No idea how to fix +I am new to scripting*
Report Abuse
annabet_h is not online. annabet_h
Joined: 13 Mar 2016
Total Posts: 1475
26 Oct 2017 09:14 AM
you didn't define chosenmap properly
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