#Need help with functions and its conditions
1091 messages · Page 2 of 2 (latest)
local combo = 1
local max = 4
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:FindFirstChildOfClass("Humanoid")
local function Counter()
if combo < max then
combo = combo + 1
else
combo = 1
end
end
local function Attack()
if combo >= 4 then
local Animation = script.Parent.Animations[combo]
local animLoader = humanoid:LoadAnimation(Animation)
animLoader:Play()
else
print(combo)
if combo ~= 4 then
Counter()
end
end
end
script.Parent.Activated:Connect(Attack)```
this right
replace the attack function only
LOOK AT THE SCREEN
whats your roblox user
if combo > 4 then
animation = script.Parent.Animations[combo]
animloader = humanoid:LoadAnimation(animation)
animloader:Play()
Counter()
else
if combo == 4 then
animloader:Play()
script.Parent.Enabled = false
humanoid.WalkSpeed = 0
task.wait(4)
humanoid.WalkSpeed = 16
script.Parent.Enabled = true
end
end
end
```
that the new script
i cant on rn
new script
it only does the fourth anim
once u do the first 3
where do i put the combo print thing so we can see the output
** You are now Level 9! **
lol
can i what?
ig
where the backpack at
its working yea
then it gets enabled
but the problem is that when the tool is disabled
i can still click
on it
and it will start the cooldown
once again
instead of resetting the m1s
done.
local combo = 1
local max = 3
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:FindFirstChildOfClass("Humanoid")
local function Counter()
if combo <= max
then
combo = combo + 1
else combo = 1
end
end
local function Swing()
local Animation = script.Parent.Animations[combo]
humanoid:LoadAnimation(Animation):Play()
Counter()
print(combo)
end
script.Parent.Activated:Connect(Swing)
local function Cooldown()
if combo == 4 then
script.Parent.Enabled = false
wait(4)
script.Parent.Enabled = true
end
end```
took 15 tutorials and 3 different people
i can literally spot every issue
does it work tho?
gud
wait i think this is an old version
local tool = script.Parent
local combo = 1
local max = 3
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:FindFirstChildOfClass("Humanoid")
local swingTick = 0
local function Counter()
if combo <= max
then
combo = combo + 1
else combo = 1
end
end
local debounce = false
local anim
local function Cooldown()
if combo == 4 then
script.Parent.Enabled = false
wait(4)
script.Parent.Enabled = true
end
end
local function Swing()
if debounce then return end
debounce = true
if tick() - swingTick >= 2 then
combo = 1
Cooldown()
end
local Animation = script.Parent.Animations[combo]
anim = humanoid:LoadAnimation(Animation)
anim:Play()
if combo == 4 then
Cooldown()
else
script.Parent.Enabled = false
anim.Stopped:Wait()
script.Parent.Enabled = true
end
Counter()
swingTick = tick()
print(combo)
debounce = false
end
script.Parent.Activated:Connect(Swing)
heres the new version
looks good
be proud please
pls if its solved close this post
k
hi
