Well, hi
i’am making a game and im trying to make a combo system(must be server sided).
I’ve never done any and that why today im asking for your help.
since 3 days im thinking about how i could make one but still nothing
here’s my current script :
local cache = {}
local count = 0
game.ReplicatedStorage.Remotes.Attack.OnServerEvent:Connect(function(executor, Type)
local tool = executor.Character:FindFirstChildOfClass("Tool")
local Track = cache[executor.UserId]
if tool and not executor.Stats.IsCooldown.Value == true then
if not Track and Type == "M1" and count == 0 then
cache[executor.UserId.." M1"] = executor.Character.Humanoid.Animator:LoadAnimation(tool.Attack.Slash1)
Track = cache[executor.UserId.." M1"]
Track:Play()
end
end
end)
Alright hey, so your logic would probably be something as the following:
1. Make a combo variable 2. For each hit add +1 to the combo variable 3. You could use tick() to compare the last time they clicked with the current time they click, that will help you with figuring out what attack they want to do.
Example of tick:
local t = tick()
wait(2)
print(tick() - t) --The time elapsed since t was made
4. Play a different animation depending if you’re still in the time limit you want to have since you last hit and depending on your combo var, if the time is greater than your limit reset your combo to 0.
ok so, i have a problem and the problem is that i dont know how to organize it like :
-- // TO TRAIN MYSELF WITH COMBO
local mouse = game:GetService("Players").LocalPlayer:GetMouse()
mouse.Button1Down:Connect(function()
local combo = 0
print("First")
local t = tick()
if (tick() - t) <= 1 then
print("Second")
end
end)