Cancelling abilities for a grabbed player

Hello there! I am here today since I have a particular question that I have been pondering for a while. And as of now, I haven’t really figured out a solution yet. In my fighting-like game, I have created an ability that allows you to grab people, spin them around and around, and then throw them pretty far. And one thing I noticed is that after making a few other abilities, the scripts that run the other abilities still run, and the visual and audio instances (Visual examples being shockwaves, trails, and or rubble) don’t disappear. Now I am aware that it can’t be removed unless it’s coded to do so. And so I’ve tried a few methods, but they have yet to work, and as a result, It has built up some anxiety inside me, that causes me to avoid improvised experimenting so I don’t ruin my scripts. If you guys have any ideas of what the solution is I’d really love to know, as it would really help me out a bunch! Anyways, Thank you for your time, I hope you have a good day! take care! :grinning_face_with_smiling_eyes: :+1:

2 Likes

So, you want to cancel/disable all the other fighting moves while the person is spinning? Could you use a debounce shared between the moves so the other moves can’t be used until the swinging move finishes?

Yeah, I made sure to. But when a move is performed before the grab is used, the script still runs.

Edit: And Yes, That’s correct :slight_smile:

Could you make some sort of interrupt event shared between the scripts and have them handle cancelling their animations/effects? Perhaps a BoolValue and have the scripts listen for a .Changed event, then interrupting any current moves if the value is true.

And if you are worried about wrecking your scripts with experimenting just make a second ‘test place’ so you can put the scripts in that one and experiment with them without wrecking your originals.

I could give it a try, thanks for the advice :+1:

alrighty, thank you very much! :+1:

I use a string value for this as so:

local usingMove = Instance.new"StringValue"
usingMove.Value = ability
usingMove.Name = "UsingMove"
usingMove.Parent = character

then make an additional check in my ability code:

if character:FindFirstChild"UsingMove" then return end 

of course you can use collection service or modules too, this is my way though.

gotchya, thank you :+1:

[ignore this text in brackets]

I managed to add the BoolValue, although I don’t know how I would stop the script from running after that. (Note: They’re used by remote functions).

Actually I managed to figure out an alternative, where instead of disabling the opponent’s script mid way, the ability itself cannot be activated if another move is being used by the same person. Thank you guys though, I appreciate it! :+1: :slight_smile: