for a more advanced hitbox, i suggest when the input is detected send it to server, then on server play the animation with a marker, and use invoke to get the hitbox from client, checking if it is valid, then doing a sanity check with magnitude, regardless this is great for someone just learning, a follow up video on a more advanced hitbox would be sick
i dont understand why the hitbox has to be instantiated from the client. It doesnt make a lot of sense to have the sanity check either, if the only way to "cheat" the hitbox is by teleporting the player to the enemy, you would be making useless calculations by grabbing the magnitude (as teleporting the plr with hacks would result in the cottect magnitude anyway)
one thing that i will mention is that using touch event will make it so its super easy for hackers to control how big the hitbox is and they can hit anyone on the map if they wanted to, so to prevent that you can add a check that checks how far away the attacker is from the victim and based on that the server has to decide on if the attack should be allowed or not, so the max distance that the server allows the attack to be from has to be decided by you based on how far away the attack usually goes. you should also make the distance a bit longer than expected so that laggy players can still hit people, but the down side of doing that is that hackers can now hit players from further away so you really need to balance the max attack distance value
it should be mostly fine since the hitbox is created in the server, but this could be bypassed by teleporting the player to the enemy but at that point its a whole nother' issue
@@SolepsusYTvery true if anyone is interested i'd recommend watching suphi kaner's video on anti-cheat, he's one of the best roblox tutorial channels there is he talks about checking position with respect to character speed and doing an action based on the outcome, this battles instant teleportation to an object
@@SolepsusYT if the part is a parent of the player(hacker) then the touch event works based on how the player detects it as in it wont matter if its a server script because the detection is client sided either way. so touch event should never be fully trusted. an example of this is that classic swords have a server script and it uses a touch event but any time you join a game like sword fights on the heights there are hackers who make their sword hitbox size 1024(the biggest part size) and then they kill everyone on the map
@@galicate maybe he could use FindPartsInRegion3 but im not sure if this is the best solution in this case. doing many raycasts in the shape of a the leg or arm could also work. i made a sword on roblox by raycasting the "shape" of the sword every 0.2 seconds on the client side when someone attacks with a sword and if one of the raycasts hits, then its sent to the server and the server checks the distance of the players to make sure the attack is allowed
I know this is old but I recommend calculating what targets are hit by the hitbox on the client because its more responsive and it puts less of a load on the performance of the server. From there, you can just run sanity checks on the server to make sure the target is actually in a reasonable position to hit the target through magnitudes and dot products.
thats true but the point of the video was to show the mechanism behind hitboxes and method of use. It's better to have client side hitboxes but then I would have to cover sanity checks / anti cheat and i didnt wanna go in that direction yet, would be too long to cover in the vid
Currently shapecasting is pretty new and is not recomended for hitboxes due to how collison detection works, if you wanna make a good hitbox use raycasting and attachment points.
This is a pretty good tutorial and I want to achieve something like what this video has shown. I did the script right with no mistakes but the part isn't spawning do you mind explaining it to me?
for a more advanced hitbox, i suggest when the input is detected send it to server, then on server play the animation with a marker, and use invoke to get the hitbox from client, checking if it is valid, then doing a sanity check with magnitude, regardless this is great for someone just learning, a follow up video on a more advanced hitbox would be sick
i dont understand why the hitbox has to be instantiated from the client. It doesnt make a lot of sense to have the sanity check either, if the only way to "cheat" the hitbox is by teleporting the player to the enemy, you would be making useless calculations by grabbing the magnitude (as teleporting the plr with hacks would result in the cottect magnitude anyway)
@@SolepsusYT client hitboxes detect quicker than server hitboxes, responsiveness from clients are way better than server
@@SolepsusYT Assuming your hitbox is server-sided as it should always be
You should NEVER play animations on server
well i dont know about NEVER. But it does reduce lag, albeit not that much.@@Musab_YB
You can use a combination of a hitbox and a raycast to detect for walls and whatnot by the way
one thing that i will mention is that using touch event will make it so its super easy for hackers to control how big the hitbox is and they can hit anyone on the map if they wanted to, so to prevent that you can add a check that checks how far away the attacker is from the victim and based on that the server has to decide on if the attack should be allowed or not, so the max distance that the server allows the attack to be from has to be decided by you based on how far away the attack usually goes. you should also make the distance a bit longer than expected so that laggy players can still hit people, but the down side of doing that is that hackers can now hit players from further away so you really need to balance the max attack distance value
it should be mostly fine since the hitbox is created in the server, but this could be bypassed by teleporting the player to the enemy but at that point its a whole nother' issue
@@SolepsusYTvery true
if anyone is interested i'd recommend watching suphi kaner's video on anti-cheat, he's one of the best roblox tutorial channels there is
he talks about checking position with respect to character speed and doing an action based on the outcome, this battles instant teleportation to an object
The Touched Event is really unreliable too, shouldnt be used for anything honestly.
@@SolepsusYT if the part is a parent of the player(hacker) then the touch event works based on how the player detects it as in it wont matter if its a server script because the detection is client sided either way. so touch event should never be fully trusted. an example of this is that classic swords have a server script and it uses a touch event but any time you join a game like sword fights on the heights there are hackers who make their sword hitbox size 1024(the biggest part size) and then they kill everyone on the map
@@galicate maybe he could use FindPartsInRegion3 but im not sure if this is the best solution in this case. doing many raycasts in the shape of a the leg or arm could also work. i made a sword on roblox by raycasting the "shape" of the sword every 0.2 seconds on the client side when someone attacks with a sword and if one of the raycasts hits, then its sent to the server and the server checks the distance of the players to make sure the attack is allowed
I know this is old but I recommend calculating what targets are hit by the hitbox on the client because its more responsive and it puts less of a load on the performance of the server. From there, you can just run sanity checks on the server to make sure the target is actually in a reasonable position to hit the target through magnitudes and dot products.
thats true but the point of the video was to show the mechanism behind hitboxes and method of use. It's better to have client side hitboxes but then I would have to cover sanity checks / anti cheat and i didnt wanna go in that direction yet, would be too long to cover in the vid
@@SolepsusYT ye i see where you are coming from!
great tutorial for beginners but for any beginners that want to make it more advanced and less exploitable try using shapecasts instead
Currently shapecasting is pretty new and is not recomended for hitboxes due to how collison detection works, if you wanna make a good hitbox use raycasting and attachment points.
Me
Not a dev
Watching this
Useful knowledge 👍
hey you never know lol
This is a pretty good tutorial and I want to achieve something like what this video has shown. I did the script right with no mistakes but the part isn't spawning do you mind explaining it to me?
that thumbnail is giving me byteblox flashbacks.,.,.,... if you end up making a community please care for it.,,.,.,....... regardless good video!
Lmao
@@byteblox100 yooooooooooooooooooo
it's like Smash 64's hitboxes
underrated
I now know how to weld a part to a player...
by basically welding the part to a player, man I'm stupid 😭
what
I really fw ur work style bless bro im subbing
Bro are you making a Muay Thai Game?
why isn't my hitbox spawning?
also when u move objects using the move arrows, you have the position for that axis displaying, how can i do that? thanks
do you mean the cube thing at the top right?
Is it good performance wise to make the weld on the server and deal damage within the same script?
babe byteblox dropped
Where did bro just get a hitbox at in the beginning
that was just a regular part made slightly transparent, red, and not collidable
how to make cooldown for that script?
Check guides on debounce's
dawg thanks for this, how long have you been scripting for?
a little over 3 years!
Bro, may i get that model? I like that bro.
May i hire you as scripter bro? I'll give you an reward.
Depends on what work
could plis put the code in the decscripion or on a comment
0:51
nice
can u send me the code pls