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

how do I make a radius script from player to npc?

I am trying to get a radius from a local player within an NPC any help? I made this magnitude script but you guys are probably looking at it thinking its a joke.

local Player = game.Players.LocalPlayer.Character local Zombie = game.Workspace.Zombie

if (Player.Torso.Position - Zombie.Torso.Position).magnitude <= 10 then print("it works") end

1 answer

✓ Accepted answer

I will start you off by saying that you only check for the distance once, meaning if the player moves, it wont print again. What you could do is but that if statement in a while wait() do statement.

while wait() do
	if (Player.Torso.Position - Zombie.Torso.Position).magnitude <= 10 then
		print("It works!")
	end
end

1 comment

0

thanks, it worked!

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