PLEASE DON’T USE THIS MAGNITUDE HITBOX MODULE!! I URGE YOU TO USE AN IMPROVED MUCH MORE OPTIMIZED/PERFORMANT MODULE (PLEASE USE THIS MODULE)
I DON’T RECOMMEND YOU TO USE THIS MODULE PLEASE USE THIS MODULE (PLEASE USE THIS MODULE) I’M NOT GOING TO DELETE THIS PAGE BECAUSE I WISH TO ARCHIVE THIS AS IT’S MY FIRST COMMUNITY RESOURCE
Introduction:
This is my first community resource any feedback and criticism will be helpful. Ok, so I’ve yet to see a single hitbox module that uses magnitude. So I decided to make my own.
This module is very easy to use as it uses OOP, allowing you to easily create hitboxes. The only limitation of this module is that it only hits someone once.
Example usage of this module:
--this script will be put inside of a tool.
local hitboxModule = require(path to this module)
local tool = script.Parent
local newHitbox
tool.Equipped:Connect(function()
newHitbox = hitboxModule.new(script.Parent.Parent,tool.Handle,3,false) --this would make a hitbox
--for our character who will be immune of getting
--by their own hitboxes.
--The hitbox part is our character's tool handle.
--the range of this hitbox is 3 magnitudes.
--And it would not be automatically destroy or clean up
--once you do newHitbox:StartHitbox(...)
newHitbox.Hit:Connect(function(enemyCharacter) --this function will fire once someone gets hit by the hitbox
enemyCharacter.Humanoid:TakeDamage(5) --and they will take 5 damage
end)
end)
tool.Unequipped:Connect(function()
newHitbox:StopHitbox() -- this stops any hitboxes that started for this tool
newHitbox:Destroy() -- this will destroy the hitbox and disconnect all signals therefore cleaning things up
end)
tool.Activated:Connect(function()
newHitbox:StartHitbox(3) -- the hitbox will last for 3 seconds.
end)
There’s of course a better way to use this.
The API for this module can be found inside of the module itself.
Again this is my first community resource, any feedback and criticism would be super helpful to improving this module and this post in general.
Forgot to mention that if you want to turn off the hitbox visuals you’ll need to go into the hitbox module script and change the visual variable to false
local visuals = false--set this to true if you want to visualize the hitboxes
Sure! It’s often used to test a computer’s specs. (I think it’s also about market charts too)
Basically they are charts showing performance / profit / costs / prices, etc.
But in this case, i think just adding a startTime = time() <<CODE>> print(startime-time()) as a test would be enough (Using your MOST performance expensive + cheap method)
→ Note that im talking about the time it took to run it which might not sound too exact. But it does check how time it took to load so it’s fine! (which is at least what im looking for)
Now when it comes to different devices… I would recommend running a local server with the 2MGs roblox’s servers have, as literally any window for script performance is absurdly complex or depends on your computer.
This might take a while but, you know those “Why this over that” ? That’d totally convince people if you had lower numbers.
Or in a few words. Numbers - Data - Info about performance
Sorry if this seems dumb, but where do I put the small piece of the code? Do I put it in the module itself? or a normal script? I put this piece of code in the module and the basic example and got 0 from the output.
Set start time before you run the Hitbox check. Then after the check.
About where: you place it as if someone was making a script using your module (not the API but some script outside, you can also do some benchmarking inside your API to check which part of the code slows it down)
I gotta say I’m not experienced in this at all so I might get many things wrong! Maybe you can find some posts about this. What I’m looking for is how much it takes for the Hitbox to run the checks n such.
So if you still get 0 then I guess that’s good? Try putting many many parts inside and give it a heavy task. make it have a hard time. Whatever makes it slow
Well, I told you I only know the concept and what it’s used for but not exactly do it myself. I plan on doing some benchmarking on many hitbox modules. So I’ll @ you when I get some results
I’m currently remaking the hitbox module (it may also contain the same limitations or even more in exchange for being optimization) I’ll mark the new hitbox module as solution when I’m done.