i’m making a player marker system but when i aim an a object works but but after a while it stops responding
code here:
local parts = {}
while wait(0.2) do
if Enabled.Value == true then
for _, block in ipairs(workspace.partstest:GetChildren()) do
if block.Name ~= ACTUALPLAYER.Value and block:IsA("Part") then
MARKER.Value = true
local pos = camera:WorldToViewportPoint(block.Position)
local center = camera.ViewportSize / 2
table.insert(parts, {
Block = block;
Distance = (center - Vector2.new(pos.x, pos.y)).Magnitude
})
table.sort(parts, function(a, b)
return a.Distance < b.Distance
end)
local closest_part = parts[1].Block
local datos = closest_part
local igualar = {
CFrame = datos.CFrame:ToWorldSpace(CFrame.new(0, 0, 0))
}
local GUIPART = char:WaitForChild("GUIblock")
if marcado == false then
marcado = true
tween:Create(GUIPART,info,igualar):Play()
wait(0.4)
marcado = false
end
end
end
end
end