I am trying to set up a teleport system using a single script. In each part I want you to teleport from via touch I have a stringvalue which is the part I want you to teleport to the position of. Instead, I get the error “Argument 1 missing or nil”. Here are some images of the value and my code I have so far
local returnValue = {};
for _, i in pairs(game:GetDescendants()) do
pcall(function()
if(i:GetAttribute("ID") == ID) then table.insert(returnValue, i) end;
end);
end;
return returnValue;
end;
for _, h in pairs(getInstancesWithID("Teleporter")) do
if(h:IsA("BasePart")) then
h.Touched:Connect(function(hit)
local Pos = h.Destination.Value
hit.parent:moveTo(Pos.Position)
end)
end;
end;```