#I am needing help on a script to make a a combat system

1 messages · Page 1 of 1 (latest)

viral harness
#

I alr make the m1 system with a tutorial, but now I want to make a block system and I cant because when I need to change the combat client or the server combat script the m1s stop working, so I am searching for someone that could help me, the combat client local script is this:



local UIS = game:GetService("UserInputService")




local plr = game.Players.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local M1 = humanoid:LoadAnimation(script.Animaciones.M1)
local M2 = humanoid:LoadAnimation(script.Animaciones.M2)
local M3 = humanoid:LoadAnimation(script.Animaciones.M3)
local combo = 1
local cooldown = false
local lastcooldown = false


UIS.InputEnded:Connect(function(I,E)
    if E then return end
    if I.UserInputType == Enum.UserInputType.MouseButton1 then
        if character:FindFirstChild("Stunned") then return end
        if cooldown == true then return end
        if lastcooldown == true then return end
        spawn(function()
            cooldown = true
            script.Swing:Play()
            task.wait(.65)
            cooldown = false
            
        end)
        if combo == 3 then
            game.ReplicatedStorage.MainEvent:FireServer("Last")
            M3:play()
            spawn(function()
                lastcooldown = true
                task.wait(1.3)
                lastcooldown= false
            end)
            spawn(function()
                task.wait(.1)
                combo = 1
            end)
        elseif combo == 2 then
            game.ReplicatedStorage.MainEvent:FireServer("Regular")
            M2:play()
            combo = combo + 1
        elseif combo == 1 then
            game.ReplicatedStorage.MainEvent:FireServer("Regular")
            M1:play()
            combo = combo + 1
        end

    end
end)
stray ember
# viral harness I alr make the m1 system with a tutorial, but now I want to make a block system ...

You just need to make a simple FSM.

Every player will have a few states, either normal or blocking (you could add more if you wish), they can enter these states by performing certain actions (just like an attack forcing somebody out of a block, or them running out of stamina. Depends on the game).
Basing your damage off of this is as easy as just adding in an if statement, to check the other party's state (which should all be done on the server to be frank, it can be done on the client yet I don't feel like explaining netcode)

viral harness
#

u dont rlly have to help me that much, if u dont want I can search on internet

stray ember