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

Add players to table not working?

Hi guys! I still haven't got this working - I want to check if the thing touching the brick is player and then if it is, carry on with the rest of the script to put them in a table.... but for some reason, it's still not working :( Any help would be greatly appreciated :) Thanks in advance!!

script.Parent.Touched:connect(function(hit)
print ("Player touched!")
if hit.Parent:FindFirstChild("Humanoid") then
for key, value in next, _G.Escapers do
if value == hit.Parent.Name then
return
end
end
end

table.insert(_G.Escapers, hit.Parent.Name)
end);

1 comment

0

Whats the error?

1 answer

Not positive. Haven't worked with _G tables or functions, but I think I know the problem.

Try this

while _G.Escapers == nil do --Might've needed a wait for variable.
wait()
end
script.Parent.Touched:connect(function(hit)
print ("Player touched!")
if hit.Parent:FindFirstChild("Humanoid") then
for key, value in pairs (next, _G.Escapers) do --Might've need that pairs.
if value == hit.Parent.Name then
return
end
end
end

table.insert(_G.Escapers, hit.Parent.Name)
end);

But then again, first time after doing some research.

1 comment

0

Thanks, but it still doesn't work :(

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