So im making a hit box for a mob for example a mob is right next to me it touches me it fires it works but Touched event only fires when I do something or move right?
cause when I stood still the touched event did not fire and i stood still and i didnt take any damage i think this might be a problem because people might take advantage of this to get easier farm is there another event that dosent require you to move and if your inside the touch box you automatically take damage?
Hello! I'm BlackOrange and I will be helping you out today.
There are many other ways instead of .Touched
to do this type of stuff. Here is a list below:
Touched
, Simple event, what you want to do is create a invisible part that moves around the npc and this will make it so that if the part touches the character it will deal damageMagnitude
, You can simply use a infinite loop and check the magnitude. If the NPC is close enough start dealing damageRaycasting
, You can also use rays to do this
Note these solutions will require loops!
More Information:
Touched: wiki.roblox.com/index.php?title=API:Class/BasePart/Touched
Magnitude: https://developer.roblox.com/articles/Magnitude
Raycasting: https://developer.roblox.com/articles/Raycasting
The main point of this answer is to help you get an idea on how to do this. There are many ways to script one thing and get the same result. Some ways are just more efficient.
Hope this helped!
Best of luck developer!
Yes there is. In my opinion, I believe a more efficient tool than touched is Region3. I say this because with Region3 you can check if a player is inside the desired area. An example: If you're trying to make a safezone.
ROBLOX Wiki: https://developer.roblox.com/api-reference/function/Workspace/FindPartsInRegion3