![]() ![]() While true do -Start an infinite loop checking if there are any nearby enemies within 5 studs radius of our players character every 0,2 seconds If there are enemies detected then we can deal damage to them directly by setting their humanoid health value down by 1 each time they're detected We also use raycasting here just as an extra precaution so that we don't accidentally shoot friendly targets Since raycasting only gives us objects which have a non-zero collison group number set Then shooting those targets should be pretty safe! - wait(0,2)- Wait two tenths of second before running again - Begin actual loop - Get list of characters around us - Obtain all parts found within 5 units range from our characters' torso position and store these parts inside our 'foundParts' table - let foundParts=workspace:FindPartsInRegion3WithIgnoreList(char.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |