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

Add players to table not working?

Asked by 10 years ago

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);

0
Whats the error? MessorAdmin 598 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

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.

0
Thanks, but it still doesn't work :( jjwood1600 215 — 10y
Ad

Answer this question