How to Make a Fighting Game on Roblox — Combat System & PvP Tutorial

How to Make a Fighting Game on Roblox

Popular Roblox Fighting Games

Combat System

-- ReplicatedStorage/CombatModule.lua

local CombatModule = {}

CombatModule.Combos = {

-- M1 combo (basic attacks)

{ name = "Punch1", damage = 10, knockback = 5, duration = 0.3 },

{ name = "Punch2", damage = 12, knockback = 5, duration = 0.3 },

{ name = "Punch3", damage = 15, knockback = 10, duration = 0.4 },

{ name = "Punch4", damage = 20, knockback = 15, duration = 0.5 },

{ name = "Uppercut", damage = 35, knockback = 30, duration = 0.6 },

}

function CombatModule.ExecuteAttack(player, comboIndex)

local character = player.Character

if not character then return end

local humanoid = character:FindFirstChild("Humanoid")

if not humanoid or humanoid.Health <= 0 then return end

local combo = CombatModule.Combos[comboIndex]

if not combo then return end

-- Create hitbox

local hitbox = Instance.new("Part")

hitbox.Size = Vector3.new(5, 5, 5)

hitbox.Position = character.HumanoidRootPart.Position + character.HumanoidRootPart.CFrame.LookVector * 3

hitbox.Anchored = true

hitbox.CanCollide = false

hitbox.Transparency = 1

hitbox.Parent = workspace

-- Check for hits

local hits = workspace:GetPartsInPart(hitbox)

for _, hit in ipairs(hits) do

local targetChar = hit.Parent

local targetHumanoid = targetChar:FindFirstChild("Humanoid")

if targetHumanoid and targetChar ~= character then

targetHumanoid:TakeDamage(combo.damage)

-- Apply knockback

local direction = (targetChar.HumanoidRootPart.Position - character.HumanoidRootPart.Position).Unit

targetChar.HumanoidRootPart.Velocity = direction * combo.knockback + Vector3.new(0, combo.knockback / 2, 0)

end

end

hitbox:Destroy()

end

return CombatModule

Ability System

-- Abilities with cooldowns

local abilities = {

Fireball = { damage = 50, cooldown = 8, range = 100 },

Teleport = { distance = 30, cooldown = 5 },

HealingAura = { healing = 30, cooldown = 15, radius = 20 },

UltimateSmash = { damage = 200, cooldown = 60, aoe = 15 },

}

local cooldowns = {}

local function useAbility(player, abilityName)

local ability = abilities[abilityName]

if not ability then return end

-- Check cooldown

local lastUsed = cooldowns[player.UserId .. abilityName] or 0

if tick() - lastUsed < ability.cooldown then return end

cooldowns[player.UserId .. abilityName] = tick()

-- Execute ability

-- ... specific logic per ability

end

Skip the Hard Part — Use Roblox Factory

Roblox Factory generates your entire game — 13+ Lua scripts, art, marketing — in one click for $29/month.

👉 Try Roblox Factory Now →


All articles · Roblox Factory · Game & Anime ARMY