Is there any other function beside FindFirstChild that doesn't require a string? I need it because I want this script to work universally so I won't have to keep changing the Guis name.
Ok,so this is how the script works it finds the player distance from the current part if distance is less then 4 then it will clone the Gui into the Players Gui and then it will see if the player has the Gui by checking the Guis name,however if the the player already has a gui with the same name it won't work,is there another way to do it? The script is setup like this.
For example: A function where you able to tag a object and make it find it first?
Copy = Gui:Clone()--Tagged as Copy
FoundCopy = Player.PlayerGui:FindFirstChild(Copy)--Doesn't won't work because it's not a string
while wait() do
for _,Player in pairs( game.Players:GetChildren() ) do
-------------------------------------------------------
local Part = script.Parent
local Character = Player.Character
local Distance = (Character.Torso.Position - Part.Position).magnitude
-------------------------------------------------------
print(Distance)
if Distance < 4 then
for _,Gui in pairs (Part.GuiFolder:GetChildren())do
Copy = Gui:Clone()
FoundCopy = Player.PlayerGui:FindFirstChild(Copy.Name)---Finds the Gui named "ScreenGui"
if not FoundCopy then---Checks if the player doesn't have the gui
Copy.Parent = Player.PlayerGui
end
end
end
end
end

1 comment
Just keep the GUIs named different things, which should make things easier for you since you can then tell the difference too