Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
VVired 28
7 years ago
Edited 7 years ago

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

Log in to vote
0
Answered by
Master_JJ 229 Moderation Voter
7 years ago

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
0
thanks, it worked! VVired 28 — 7y
Ad

Answer this question