im making a game and need attack script for an r6 npc i have everything like the movement finished but now i need some attack script please someone tell me how to make some.
To find the nearest you can do a Magnitude check with the target
local Target = Workspace.Enemy.PrimaryPart --Example local YourPosition = Script.Parent.PrimaryPart local Distance = (Target.Position-YourPosition.Position).Magnitude if Distance < 50 then --near the target by 50 Print("You are near the target") end