What would be a smart route to take when trying to show, through GUI Text Labels, what "items" are around you.
My first instinct was to go with a htibox on the items and then put the item in the "Vicinity" Gui, however trying to keep everything local for GUI sake that might not be the best option. My initial attempt was this inside of the "Rock" part:
local rock = script.Parent
local hitBox = script.Parent:FindFirstChild("HitBox")
local RS = game:GetService("ReplicatedStorage")
local vicSlot = RS.VicinitySlot:Clone()
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
print("Got Rock")
end)
hitBox.Touched:Connect(function (hit)
if hit.Parent:FindFirstChild("Humanoid") then
local vic = hit.Parent.PlayerGui.TAB_Menu.Vicinity
--Then I thought I could replicate the item name and image to the first open "Vicinity" slot. Obviously this doesn't work because PlayerGui is not a valid member of Model.
end
end)
I understand the Vicinity GUI part should just be all client side just not sure how. I'm currently just looking into any ways for the LocalPlayer to detect items within a certian area around them. Similar to the hitbox idea but on the client side? I appreciate any help.
The rest of the GUI stuff I don't think is important to include for this problem but let me know if anything additional will help or left something out.

7 comments
use magnitude
so, basically, you are trying to make a gui tell text
explain more
@theKing, can you explain a bit more? i know your saying check mag and if item is 'in Range' then its 'in Vicinity', when am I checking this? continuously on all items?
magnitude is basically the distance formula, it finds every instance near another instance and calculates the distance between them
@Dom, I'm trying to check "If an item in the workspace is within a certain vicinity, lets say 20 studs, of the player" I can undestand the GUI stuff in general its the check I am not fully understanding. My initial attempted checked via the server (the "rock" part that is in the workspace and if anything touches its "hitbox" which is just a transparent part around it) But I wanna keep it local
@MC "it finds every instance near another instance and calculates the distance between them", I've only known it to be like (posA-posB).Magnitude. Would I loop this or I guess my question am i just checking the mag of the player and every item no matter the distance? I guess i'm lost on when/how much to be checking the mag of all the items to find the ones close enough to be in vicinity