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

Global Table recall help?

Asked by
NotSoNorm 777 Moderation Voter
8 years ago

So I have defined a global table (first time using klol) and I want it to use the first option in the table in a path

IE. game.Workspace.Spawns._G.StartingPlaces[1].

error: _G is not a valid member of spawns

_G.StartingPlaces = {"StartingPlaceOne","StartingPlaceTwo","StartingPlaceThree"}
print(_G.StartingPlaces[1].."Loaded")
print(_G.StartingPlaces[2].."Loaded")
print(_G.StartingPlaces[3].."Loaded")
while true do
    for timewait = 5, 0, -1 do
        wait(1)
        game.StarterGui.PeopleInGame.Time.Text = timewait
    end
game.StarterGui.PeopleInGame.Time.Text = "Time"
s = game.Workspace.Spawns
p = game.Players:GetChildren()
for i = 1, #p do
if game.Workspace:FindFirstChild(p[i].Name) then 
p[i].Character.Torso.CFrame = s._G.StartingPlaces[1].CFrame * CFrame.new(math.random(-3,3),8,math.random(-3,3)) --halpls
end
script.Parent.NumberOfPeopleInGame.Value = #p
end
end

1 answer

Log in to vote
3
Answered by
KoreanBBQ 301 Moderation Voter
8 years ago

Everytime you use _G.StartingPlaces in the format something._G.StartingPlaces, replace it with:

something[_G.StartingPlaces[whatever]]

IE. game.Workspace.Spawns[_G.StartingPlaces[1]]

0
thx bbe NotSoNorm 777 — 8y
4
no prob. also how do i get better reputation on SH? i want to start going on community chat KoreanBBQ 301 — 8y
0
When people upvote your awnsers you get reputation i think lol NotSoNorm 777 — 8y
Ad

Answer this question