So when I'm not even close it still prints this idk why
local mic = workspace.AnnouncerTable.MIC.Main local range = 5 game.Players.PlayerAdded:Connect(function(p) p.CharacterAdded:Connect(function(char) if char ~= nil then local torso = char.Torso if (mic.Position-torso.Position).magnitude >= range then print(p.Name.." Is close") end end end) end)
Looking at your code, it only runs once when the player joins and when the player resets. If you take a look at line 8, you would see
if (mic.Position-torso.Position).magnitude >= range then
This basically says "if the mic part and the torso distance is bigger than or equal to the range variable then print. You would want to change it so it is if the distance is less than or equal. So just change the >= to <= and you should be set
I have tested this in-game and it will work, I noticed that you aren't looping the magnitude checking so I have put one in for you. As I have mentioned before, you needed to change >=
to <=
local mic = workspace.AnnouncerTable.MIC.Main local range = 5 game.Players.PlayerAdded:Connect(function(p) p.CharacterAdded:Connect(function(char) while wait() do local torso = char.Torso if (mic.Position-torso.Position).magnitude <= range then print(p.Name.." Is close") end end end) end)