How Would i detect if another player is near me? if anyone could show me an example or a solution it would be highly appreciated.
You could iterate through all the players and check the magnitude from the target player’s root part to the current player’s root part. If it’s less than a certain number (e.g. 12) then you can consider them nearby.
for _,plrs in pairs(game.Players:GetPlayers()) do
if (plr.Character.HumanoidRootPart.Position - plrs.Character.HumanoidRootPart.Position).magnitude <= 20 then
print("user is near")
else
print("no user is near.")
end
end
something like this?, i did something like this and it didnt work.
Did you do it in a loop? It seems okay to me
i didnt put it in a loop but i make it fire when keycode using UserInputService.
It might be something to do with that, could you send that code?
The remote fires and all and it runs the thing is it says “Player is near” when im 50 feet apart from a player.
Maybe try printing the result of the calculation and send what it says here
Feet? You might be within 20 studs and just not aware of it. Could you record a video of you checking or send a picture of how far apart you think 50 studs is?
Sarcasm, i did go far above 20 studs, ill provide a video in a second.
What is the reference point you’re using in that clip?
It says im near a player when im 50 studs away.
Nevermind i fixed it, it was returning my Character Instead of someone elses.