#How do I get the animation from the table?
1 messages · Page 1 of 1 (latest)
For loop could work
Maybe I'm not 100% the objective
could that go inside of a function?
yea
local ComboCount = 0
tool.Activated:Connect(function()
ComboCount = CombotCount % MaxCombo + 1
AnimationTracks[ComboCount]
end)
I see you finicking around with waits, if you want to add a timeout period here's the code for that
local ComboCount = 0
local LastHit = 0
tool.Activated:Connect(function()
local timePassed = os.clock() - LastHit
if timePassed > TIMEOUT then
ComboCount = 0
end
ComboCount = CombotCount % MaxCombo + 1
AnimationTracks[ComboCount]
LastHit = os.clock()
end)
os.clock() returns time passed since some specific time based on the device
By saving when the last attack happened you can deduct it from the current time to get how much time has passed since.
% gives you the remainder of if you were to do division, which is useful for looping numbers.
Here's an example
3 % 5 = 3
4 % 5 = 4
5 % 5 = 0
since in the code I am also adding one it will keep incrementing and eventually reset once it reaches 5
Omg thx sm!