I want to make my combo to end when you havent hit in like 1-2 seconds, like other games when you dont finish your combo in time it resets. How would i go about making a sort of time to reset it?
local combo = Instance.new("IntValue")
combo.Name = "Combo"
combo.Value = 0
combo.Parent = player
local hasHit = Instance.new("BoolValue")
hasHit.Name = "HasHit"
hasHit.Value = false
hasHit.Parent = player
--whenever player hits do hasHit.Value = true
spawn.task(function()
while task.wait(2) do
if hasHit.Value == false then
combo.Value = 0
else
combo.Value = combo.Value
end
end
end)
They would usually do it like this, by storing the combo stat inside the player.
Okay, i alreaay have a combo system in place and ill add that to it, now what would you reccomend to make llike a timer to see if they have hit in the last 2 seconds?
I’ve edited the code, should be a little more explanatory now.
Yeah that seems more explanatory, ill make sure to use this. I’'ll check if it works later but i can just mark it as the soloution for now
Basically, have a bool value which tracks if the player has hit, if they haven’t hit anything for two seconds since their most recent hit set the hit bool value to false and set the combo back to 0.
It won’t work as it is, but it will if you implement it into whatever system you’re currently using, and thanks.
yup i understood that, you’re a good one. I see you on the forum all the time and you’ve helped me alot. Thanks, <3
hey, what does spawn.task do? at first glance i thought it was a normal function, and now i’m confused.