-
Adornee a gui to nearest player torso.
-
Function returns nil
-
Troubleshooting different methods
local Closest
for _,v in pairs(game.Players:GetChildren()) do
if v then
local ray = Ray.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position, (v.Character.HumanoidRootPart.Position - game.Players.LocalPlayer.Character.HumanoidRootPart.Position))
local ignore = {Player.Character}
local hit,position,normal = game.Workspace:FindPartOnRayWithIgnoreList(ray,ignore)
if v.Character and (v.Character.HumanoidRootPart.Position - Player.Character.HumanoidRootPart.Position).magnitude < 5 and hit == v then
Closest = v.Character
end
end
end
return Closest
end