#Issue with combat system stun
13 messages · Page 1 of 1 (latest)
local unstunned = tick()+60 --60 is the time how long hes stunned
repeat
local start = tick()
task.wait()
until start>=unstunned
print("unstunnded")
just do unstunned = tick()+60 every time he gets hit
** You are now Level 3! **
if you want to add like a bar, how long he is stunned you can use
local stunntime = 10
local unstunned = tick()+stunntime
repeat
local start = tick()
local precentage = (unstunned-start)/stunntime
task.wait()
until start>=unstunned
print("unstunnded")
or do *100
so it just counts further or?
** You are now Level 15! **
looks like its inside of a loop
because it prints multiple times
there
so every mouselick is a attack
and you want like a cooldown?
then you do
local stunntime = 10
local unstunned = tick()
plr.hit:Connect(function() --just a random function (does not work)
unstunned = tick()+stunntime
end)
while task.wait() do
local start = tick()
if unstunned-start > 0 then
print("stunned")
else
print("unstunned")
end
end
yes