100% found this document useful (1 vote)
1K views1 page

Death Note Find Kira Easy Free Script

This Lua script defines a function that finds the closest player character to a given position. It then loops through objects in a workspace map, attaching an event to any surfaceguis to call the closest player function when enabled, printing the name of the closest player found.

Uploaded by

kikif4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
1K views1 page

Death Note Find Kira Easy Free Script

This Lua script defines a function that finds the closest player character to a given position. It then loops through objects in a workspace map, attaching an event to any surfaceguis to call the closest player function when enabled, printing the name of the closest player found.

Uploaded by

kikif4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

local Map = workspace.

Map;
local Players = game:GetService("Players");

local function closestPlayerAtPos(Position)


local MaxRange = math.huge;
local Closest = nil;

for _, v in Players:GetPlayers() do
local RootPart = v.Character and
v.Character:FindFirstChild("HumanoidRootPart");
if not RootPart then
continue;
end;

local Magnitude = (RootPart.Position - Position).Magnitude;


if Magnitude < MaxRange then
Closest = v.Character;
MaxRange = Magnitude;
end;
end;

return Closest;
end;

for _, v in Map:GetChildren() do
if v.Name == "Id" then
local Position = v.Position;

local SurfaceGui = v:FindFirstChild("SurfaceGui");


if not SurfaceGui then
continue;
end;

SurfaceGui:GetPropertyChangedSignal("Enabled"):Connect(function()
local Kira = closestPlayerAtPos(Position);
if Kira then
print("Kira is " .. Kira.Name);
end;
end);
end;
end;

You might also like