|
| 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
|
  |
| Joined: 13 Mar 2016 |
| Total Posts: 1475 |
|
|
| 26 Oct 2017 09:14 AM |
| you didn't define chosenmap properly |
|
|
| Report Abuse |
|