Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Global Table recall help?

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

✓ Accepted answer

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]]

3 comments

0

thx bbe

4

no prob. also how do i get better reputation on SH? i want to start going on community chat

0

When people upvote your awnsers you get reputation i think lol

This discussion is preserved as it was. New answers, comments, and votes are closed.