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

attempt to index nil with 'Clone' Please help?

Asked by 3 years ago
Edited 3 years ago

When I try to load in a map and give a tool to all players it gives me this error

my script part:

1local players = game.Players:GetChildren()
2    for i = 1,#players do
3        if players[i].Character ~= nil then
4            local spawnLocation = math.random(1,#map.Teleports:GetChildren())
5            players[i].Character:MoveTo(map.Teleports:GetChildren()[spawnLocation].Position)
6            players[i].Character.Parent = workspace.InGame
7        end
8    end

how do I fix this

0
I think you are giving us the wrong line of code, because I see not :Clone() here as I guess that's giving the error. If I understand what you are trying to do, it's probably in the code where you :Clone() the map. ew_001 58 — 3y
0
No its cloning the item cadengamer11111 0 — 3y
0
sorry my full code is below. Its on line 51 cadengamer11111 0 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

My full code:

01local status = game.ReplicatedStorage.Status
02local maps = game.ReplicatedStorage.Maps:GetChildren()
03 
04while true do
05    for i = 1,10 do
06        status.Value = "Intermission "..15-i
07        wait(1)
08    end
09 
10    local rand = math.random(1, #maps)
11 
12    local map = maps[rand]:Clone()
13    map.Parent = workspace
14 
15    status.Value = "Chosen Minigame: "..map.Name
View all 88 lines...
Ad

Answer this question