Use your first code that working
Remove the command
and then add this
addCommandHandler("payphone",
function()
for i=1, payLength do
if isElementInRange(localPlayer, payphones["PosX"..i], payphones["PosY"..i], payphones["PosZ"..i], 1) then
guiSetVisible(win,true)
end
end
end
)
Change wind to your window i couldnt get it cuz i'm on mobile