Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

magnitude doesnt work and doesnt print but why?

ok so i wanna print something when a player is close to a part but it doesnt work so why doesnt it work

local plr = game.Players.LocalPlayer
repeat wait() until game.Players.LocalPlayer.Character

while wait() do
local mag = (plr.Character.Torso.Position-game.Workspace.Part.Position).magnitude
if mag <= 1 then
	print("f")
end
end

1 comment

0

Change 1 to the 10 or something between 5 and 10

1 answer

Try changing 1 to something bigger because I believe you can't be close enough to 1 unless you are not counting Y (both are on the same height or you are just not counting it) and both can't collide with each other because of the character's size and the part you are comparing to is probably big enough as well (if it's a default part then that's way more than big enough!).

Always remember this magnitude is the distance between the center of both parts so size is a big factor too.

1 comment

0

tried doing 25, didnt work

This discussion is preserved as it was. New answers, comments, and votes are closed.