Problem with Hitbox only working with certain animations

Hello.

I am having a really big issue today in Studio, and it revolves around the animations that I am making.
I have made an animation that is supposed to look like the player is attacking something. There is a Hitbox that I added for when a player activates the button to attack, the Hitbox is enabled. But for some reason, with the animation that I made, Roblox decides to make it where the Hitbox doesn’t work on that animation, and works primarily only on other stupid test animations.

Here is an example of what I mean:

When I try to attack this other Hitbox with the sword im using, the animation that is supposed to be the attack animation is stabbing through it, right? Well guess what. The Hitbox doesn’t wanna function with that animation for some reason.

But with other animations, the Hitbox will work accordingly to what I’ve tried to program for so long.

Here is the code.

TLDR:
The animation that I made for attacking enemies has a Hitbox that doesn’t wanna work when its being played. The Hitbox is apparently only gonna work when other animations rather than the one I made are played in the game
(such a weird and stupid glitch my brain feels like a bowl of ramen noodles rn)

This is so weird, this has me really frustrated. Please let me know if there are any solutions on fixing this super stupid bug with a really simple animation.

I really feel like crashing out bruh

Do your animations use keyframe events? (Dumb question, mb I just saw it)

1 Like

I’d try removing conditions in your touched functions and/or adding print statements to debug, seems to me it could be an issue with the self.attack.Value (Only thing I think could change based on your setup)

That value is perfectly fine. I don’t know what to do. If you want a place file then let me know.
There already was print statements added into the script, but they still didn’t seem to get me to a conclusion of this stupid thing.

I mean just go 1 by 1 through the if statement following up to your “yes” statement, remove them one by one until it works, then you can go more in depth with you issue, if you want me to check it out for you I can, but try to do this first

1 Like

Specifically this:

self.attackpart.Touched:Connect(function(object)
	if object:IsA('Part') and object ~= self.swordbeam and object.Name == 'enemyhitbox' and (self.attack.Value == true) then
			print('yes')
	else
		return
	end
end)

Go through the checks (object:IsA(‘Part’) and so on and remove them one by one until it eventually prints yes

1 Like

nah, this isn’t working. here is the place file if you want to check it out

in order to make the anims work your gonna have to upload them on your end i think
(both of the anims should be in there on a rig called “StarterCharacter” in workspace)

(original is the original animation used for attacking)
(test is the test animation used for attacking, which is the only one that the Hitbox likes to use for some reason)

the control script is inside of starterplayerscripts

Sorry for the big delay, I’ll go check it out rq

1 Like

You’re using a few deprecated things, such as BodyVelocity btw, also what are the controls, I think I’ll have to upload each and every animation to make them work, because wasd isn’t doing anything

would team create work or nah? i dont really got time mb
(i added you)

Should I think, just make a copy and add me to it

I’m not 100% sure if I’m interpreting your post correctly, but you should probably be using something like workspace:GetPartBoundsInBox() / workspace:GetPartsInPart() instead. If your hitbox is already clipping inside the hurtbox, Touched wont activate until the hitbox fully stops touching the hurtbox.

2 Likes

How would I use that for instead of using the Touched Event in game?

Each time you play the animation, create a hitbox and get parts in that hitbox, then do what you would do with touched, make sure it’s an enemy hitbox and so on


Everything in your script is spelled correctly, is this a mistype?

Nah, this isn’t a mistype. It’s spelled like that. The whole control script is messy, so ima fix it once the whole game is probably like 50% done or smth. Im not next to my computer atm, so ima experiment with the steps above tomorrow and see what happens

Thank you for giving me a fix man.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.