Hey Devs,
I am trying to figure out how to get a vector 3 from this table by checking if the input name = any name in the table.
So far, I know that I can’t use
if location == locationz.Name:Lower():sub(1,#location) and debounce == false then
since .Name isnt a property of a Vector3.
I tried using “Vector3Value” in a separate service, but that complicates it even more.
local locations = {
bridge = Vector3.new(-234.258, 179.5, 167.376);
church = Vector3.new(-487.252, 179, 97.5);
cody = Vector3.new(-486.75, 252.95, -122.38);
gate1 = Vector3.new(-343.752, 217.626, 167.501);
gate2 = Vector3.new(-631.627, 217.5, 170.127);
keep = Vector3.new(-486.125, 178.999, 340.999);
outside = Vector3.new(75.685, 180.87, 165.548);
roof = Vector3.new(-544.753, 297.995, 426.124)
}
Teleport.OnServerEvent:connect(function(player, name, location)
local function finder()
for _, playr in ipairs(Players:GetPlayers()) do
if debounce ~= true then
name = name:lower()
if name == playr.Name:lower():sub(1, #name) and debounce == false then
name = playr
debounce = true
end
end
end
debounce = false
--important part starts here
for _, locationz in ipairs(locations) do
if debounce ~= true then
location = location:lower()
if location == locationz.Name:Lower():sub(1,#location) and debounce == false then
location = locationz
debounce = true
end
end
end
--important part ends here
for _, playaloc in ipairs(game.Players:GetPlayers())do
if debounce ~= true then
location = location:lower()
if location == playaloc.Name:lower():sub(1, #location) and debounce == false then
location = playaloc.Character.Torso.Position
debounce = true
end
end
end
debounce = false
end
finder()
if name and location then
if name == "all" then
for _, player in ipairs(game.Players:GetChildren()) do
local char = player.Character
char:PivotTo(CFrame.new(location))
end
end
else
local char = name.Character
char:PivotTo(CFrame.new(location))
end
end)