Universal Script 📌
20.5k Views
3 Executions

detectord

Universal Script 📌
Basic
BasicPublished 10
2 years ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

detect object

View Raw
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local rootPart = character:WaitForChild("HumanoidRootPart")
local radius = 20 -- radius to you humanoid and object stud

local function getFullPath(object)
    local path = object.Name
    local parent = object.Parent
    while parent do
        path = parent.Name .. "." .. path
        parent = parent.Parent
    end
    return path
end

local function checkNearbyObjects()
    for _, obj in pairs(workspace:GetDescendants()) do
        if obj:IsA("BasePart") then
            local distance = (obj.Position - rootPart.Position).Magnitude
            if distance <= radius then
                local fullPath = getFullPath(obj)
                print("Object name: " .. obj.Name .. " | Path: " .. fullPath .. " | Distance: " .. distance) -- print
            end
        end
    end
end

while true do
    checkNearbyObjects()
    wait(2) -- delayy 
end



Comments

0
Log in to join the conversation. Login
No comments yet. Be the first!

More universal scripts

See all
Universal Script 📌
9.8k
60.7k
Bumped 12 minutes ago
Key System
Universal Script 📌
3.9k
10.4k
Bumped 13 minutes ago
Script hub
272.5k
884.6k
Bumped 31 minutes ago
Key System

Script hub

#16 this week

Verified script badgeAxon Hub 60+ Games & 800+ Features

Script hub
30.3k
92.0k
Bumped 5 hours ago
Key System

Script hub

#2 this week

Verified script badgeArcane Hub | 125+ Games & 4000+ Features