as well as keep the if distance > 75 then thing running so as soon as the distance is greater than 75 it will delete them?
local player = script.Parent.Parent.Parent table.foreach(workspace:GetChildren(), function(i,v) if v.ClassName == 'Model' and v ~= player and v.Torso ~= nil then local distance = (player.Character.Torso.Position-v.Torso.Position).magnitude if distance <= 75 then local billgui = Instance.new('BillboardGui',script.Parent) local infogui = Instance.new('TextLabel',billgui) billgui.Active, AlwaysOnTop, Enabled = true, true, true infogui.Active = true billgui.Size = UDim2.new(0,100,0,100) infogui.BackgroundTransparency, BorderSizePixel = 1, 1 infogui.Position = UDim2.new(0,-50,0,0) infogui.Size = UDim2.new(0,200,0,50) infogui.FontSize = 'Size24' infogui.Text = (v.Name)..' Lvl: '..(v.Level.Value) billgui.Adornee = v.Head if distance > 75 then billgui:remove() infogui:remove() end end end end)
Try using the ChildAdded method. It fires when a child is added to a specific place. Try this code below (It is untested):
local player = script.Parent.Parent.Parent game.Workspace.ChildAdded:connect(function (child) -- Add your code here that you need, child is the object added to the workspace. end)
This code can be modified, but should work fine for your purposes! I hope this helps, unless I read the entire question wrong.