Okey I don’t know how to name the title so am just gonna say it here.
Once the Value changes from 0 to 1, then in 1 second the value goes back to 0.
Am trying to make combat system with combos but I can’t make this.
Okey I don’t know how to name the title so am just gonna say it here.
Once the Value changes from 0 to 1, then in 1 second the value goes back to 0.
Am trying to make combat system with combos but I can’t make this.
You could use a Changed
event on the BaseValue so when it is changed and its value is not 0, wait a second and change it back to 0
Here’s a simple example to illustrate that
local val = --Your value
val.Changed:Connect(function()
if val.Value == 0 then return end
wait(1)
val.Value = 0
end)
If the value changed and the current value is 0, don’t do anything, other wise, wait a second, and set the value to 0
Hi! You could simple do:
local value = pathOfValue
value.Changed:Connect(function()
local oldVal = value.Value
-- I declared this old val vairable because I am assuming you don't want it to go to 0 if they continuously increase, sort of like a combo.
wait(1)
if value.Value > oldVal then
return
else
value.Value = 0
end
--[[ How this works:
This piec of code works because when the value is first changed, it declares a variable that sets a variable, oldVal to the value of that change. Then, it waits one second. After that, it check whether the current value is greater than that oldVal or not. If it is, then it does nothing as this is how combos work, if it isn't then it sets it to 0 meaning the combo didn't continue.
--]]
end)
I have not tested this code yet so if you find any bugs let me know!
I was just looking at Embats script and thinking that the function would run anyway after the value has changed. I think yours should work
Tested and edited. Yes it works. Thank you both