Log in to vote

How would I go about making this only check for friends at a certain place?

Asked by 5 days ago

I found this script on a youtube video, yes I know that is probably not the best, but I am still learning about teleport service. Anyway I am confused on how to make it so the script only searches for friends in the same place/game. I have tried changing a couple things but that just broke the script, so can I get some help with this please?

local Template = script.Template
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local currentPosition =,0,0,0)
local TeleportService = game:GetService("TeleportService")

local function cloneObject(object, Parent)
    local clonedObject = object:Clone()
    clonedObject.Parent = Parent
    return clonedObject

for i,v in pairs(LocalPlayer:GetPlayersOnline()) do
    local FriendImage = cloneObject(Template, script.Parent)
    FriendImage.Image = Players:GetUserThumbnailAsync(v.VisitorId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
    FriendImage.Position = currentPosition
    FriendImage.Name = v.UserName
    FriendImage.Username.Text = v.UserName
    if v.LastLocation then
            print(v.GameId, v.PlaceId)
            TeleportService:TeleportToPlaceInstance(5596062006, v.VisitorId, LocalPlayer)

    currentPosition = currentPosition +,0,0,100)

Answer this question