I have been working on a magnitude script and I got it working.
But heres the problem its supposed to print when the other player is within 10 studs of the local player.
But instead it prints all the time and it prints 2 times when the player is in 10 studs of the local player.
I want it to not print at all and only print when the player is 10 studs of another player.
Heres the script.
for _, TargetPlayer in pairs(game.Players:GetPlayers()) do
if TargetPlayer then
local TargetCharacter = TargetPlayer.Character
local Magnitude = (MainPlayer.Position -
TargetCharacter.HumanoidRootPart.Position).magnitude
if Magnitude <= 10 then
print("They are too close!")
end
end
end
Thank you for your time and happy new year! :)
