Mantein an attribute on true when doing combo [SOLVED]

ok so i have this attribute that works like a true or false, im making a pvp game, its calls “attacking”, so, this attribute allows the player to slowdown the walkspeed, on a localscript when is true.

and when is fired a function from the server, when trying to combo, this attribute goes like crazy when is soppoudly to be on true goes false bc the function before i did (an attack) is done and turns the attribute on false.
so, i just want to maintine the attribute on true,and when the player is done attaking, goes false.

a very good example is tsb.

i cant show the script bc is a bunch of scripts, but do the same method to turn on the attribute, like this:

function attack ()
--something
char:SetAttribute("Attacking", true)
task.wait(x)
--attacking shinanigans
task.wait(x)
char:SetAttribute("Attacking", false)
--something

end

should i use something rather then wait?, cuz is a bunch of different scripts. but using the same method to turn on this attribute, keep that on mind, pls help i been dealing this for years by now, i just want to make a good combat combo experience like my favorites games, like tsb, black magic 2, damn even yba, or abd, and others.

1 Like

Alright thanks!

30char

1 Like

What do you mean? What is “yapping”. I am so confused. Do you even speak English? Where are you from?

1 Like

yapping is like “too much speaking” without reason or purpuse

1 Like

Oh alright, thanks… That’s pretty rude though…

1 Like

yea, im being rude cuz you just say im a disopointment without reason, just bc of how my avatar looks

1 Like

But it is quite disappointing though!

1 Like

wdym disappointing?, me, i dont get it, and still is rude

1 Like

Just forget it. You don’t understand what I mean. So can you explain more about what your problem is currently? (With scripting.)

1 Like

i cant do a script, but i can show a script, not bc i cant do scripting, cuz is very large and i have to talk a lot of how my spagetti system work

plus my pc is slow btw wwwomp womp

I am still confused by what you’re saying… :sad:

You should use numbers instead. Everytime you do an attack, instead of setting it to true, add 1. This way everytime you attack the counter goes up 1 and can never reach 0 until the last attack stops. And instead of checking if attacking is true, check if the value is higher than 0.

1 Like

god, a guy who knows, thanks im a try that

and btw here the clip yall @KristenMack4 @DEVLocalPlayer

emh, hey, so how i turn it to 0?
when the attack end? or function

hello?¿?¿?¿?¿?¿?¿?¿??? are there?

Set the value to 0 if the player hasn’t attacked for a while if the value is above 0. Also, be patient.

Instead of doing this:

function attack ()
   --something
   char:SetAttribute("Attacking", true)
   task.wait(x)
   --attacking shinanigans
   task.wait(x)
   char:SetAttribute("Attacking", false)
end

You’d do this:

function attack ()
   --something
   char:SetAttribute("Attacking", (char:GetAttribute("Attacking") or 0) + 1)
   task.wait(x)
   --attacking shinanigans
   task.wait(x)
   char:SetAttribute("Attacking", char:GetAttribute("Attacking") - 1)
end

And to check if you’re attacking you just do char:GetAttribute("Attacking") > 0

1 Like

hi guys, i managed to do a method, not the best, but, very effective, by searching and looking i made this:

function module.attack_test(player, timee)
	local value = Instance.new("NumberValue", player)
	value.Name = "Attack_Test"
	value.Value = timee
	game:GetService("Debris"):AddItem(value, timee)
end

made this function that basicly just made makes a number value on the character and then i check on client checks if there any child added or removed with the name and the IsA, and the server do the check and bla bla, very simple, but effectible :+1:t2: