#Smacking system help

1 messages · Page 1 of 1 (latest)

crude yacht
#

Hi, I need help with debugging a slapping system. I've made a simple system but I need one fix - it works like this:
*the player equips a slap tool (invisible, it's serving as an "attack mode" rather than an actual tool)
*when player presses "E", a smack animation is playing and when player's arm is touched AND if the touched part is a character, and has a humanoid, humanoid takes 10 damage
it works fine besides one thing:
when the animation stops, and the arm didnt touch anything (so the character's arms are in a default position, near the hips) upon our arm touching someone else. that person still takes damage
I hope it will be more clear presented on the video.
Link to the scripts (pastebin) : https://pastebin.com/u/BoblokDevelopyyyr/1/nKdGJhup
Scripts hierarchy : as shown on picture
If any info is missing lemme know ;D

#

I know which part of the script is causing this, but I don't know how to change it.
It looks like upon recieving the event (server sided) it waits for the arm to touch ANYTHING (for some reason, the arm.touched event HAS to happen) and since this rig is the first thing it touches, the hitHum is equal to true, and so it takes damage from the arm even if it shouldn't have

#

*by arm.touched event I mean "arm.touched:Connect(function()end)

lime frost
crude yacht
#

I think its about it having to do the arm.touched thing, either once or multiple times, but idk why and what substitute I could use for it

#

*having to do it, even if the arm doesnt touch anything upon the slap animation, making it look weird that a still/not moving hand damages the enemy

idle relic
#

but there probably is a better way to handle this

crude yacht
#

so like, when the anim ends

idle relic
#

yeah

crude yacht
#

I thought of this before

#

but

#

wait why did my messages delete themselves

#

nvm

#

as I was saying : I though of it but I though of it like, that the humanoid would have to take dmg after 3 seconds

#

and it would be weird if the hand touched the enemy instantly

#

but in this case, it would be at anytime in the animation

#

okayy it might even work , thx man 👌🏻

idle relic
#

you could also just make a hitbox that surrounds the arm and destroy it after a few seconds

#

but yeah good luck

crude yacht
#

damn it works, thanks once again

crude yacht
#

just the base for it to work

#

as for now this thing is enough for me

#

if anyone wanted to use this as a refference