0

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

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 = UDim2.new(0,0,0,0)
local TeleportService = game:GetService("TeleportService")

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

for i,v in pairs(LocalPlayer:GetPlayersOnline()) do
local FriendImage = cloneObject(Template, script.Parent)
FriendImage.Position = currentPosition