You can write your topic however you want, but you need to answer these questions:
-
I’ve been trying to use AmPro’s Battleground Game Framework.
-
I’ve been getting errors, but I have no idea what’s wrong.
-
I’ve been trying to copy AmPro’s code on his video, I think I’ve gotten some stuff wrong and I need some directions to help me fix. I haven’t searched on DevForum because this framework is very new. Here is a video : How To Make A Roblox Battlegrounds Game 2024 Pt 1 (Combat System) - YouTube
local DemoSkillset = {}
DemoSkillset.__index = DemoSkillset
DemoSkillset.Skills = {
["M1"] = {Name = "Combat", Cooldown = 3, Key = "M1"},
["Q"] = {Name = "Dash", Cooldown = 2, Key = "Q"},
["F"] = {Name = "Block", Cooldown = 1, Key = "F"},
}
local Auxillary = require(game:GetService("ReplicatedStorage").Modules.Auxillary.Auxillary)
local services = Auxillary.Services
local Timer = require(services.rs.Modules.Auxillary.Timer)
local VFX = require(services.rs.Modules.Auxillary.VFX)
local Janitor = require(services.rs.Modules.Auxillary.Janitor)
local Hitbox = require(services.rs.Modules.Auxillary.Hitbox)
local Assets = services.rs.Assets.Skillsets.Demo
local ComboLength = .3
local M1WindUp = .2
local ComboCooldown = 1
function DemoSkillset.new(user : Player, clientData : {})
local self = setmetatable({}, DemoSkillset)
self.User = user
self.ClientData = clientData
self.Janitor = Janitor.new()
self.Combo = 1
self.LastM1 = 0
self.M1Held = false
self.Animations = {}
for i, v in Assets.Animations:GetChildren() do
self.Animations[v.Name] = user.Character.Humanoid.Animator:LoadAnimation(v)
end
self.User.PlayerGui.Main.MainFrame.UltBar.UltName.Text = "Thunderbolts"
return self
end
--hit effect--
function DemoSkillset.Hit(plr : Players, clientData : {}, data : {})
local eChar = data.HitData.Hit
if eChar:HasTag("Block") and data.Combo ~= 4 then
VFX.CreateAndEmit(Assets.VFX.Hit, eChar.HumanoidRootPart.Position)
return
end
VFX.CreateAndEmit(Assets.VFX.Hit, eChar.HumanoidRootPart.Position)
if data.Combo == 4 then
local start = time()
local con
local cf
if data.Move == "Downslam" then
cf = CFrame.new(eChar.HumanoidRootPart.Position)
elseif data.Combo == 4 then
if data.Air then
cf =CFrame.new(eChar.HumanoidRootPart.Position + Vector3.new(0, 2, 0)) * CFrame.Angles(math.rad(100), 0, 0)
else
cf = CFrame.new(eChar.HumanoidRootPart.Position, eChar.HumanoidRootPart.Position + (data.Char.Humanoid.CFrame.LookVector + Vector3.new(0, 1, 0)).Unit)
* CFrame.Angles(math.rad(90), 0, 0)
end
end
local s = Assets.VFX.Slam.Start:Clone()
s.CFrame = cf
s.Parent = workspace.FX
services.ts:Create(s.Mesh, TweenInfo.new(.2), {Scale = Vector3.new(0, .5, 0)}):Play()
services.ts:Create(s.Decal, TweenInfo.new(.2), {Transparency = 1}):Play()
services.d:AddItem(s, .3)
local s2 = Assets.VFX.Slam.Start:Clone()
s2.CFrame = cf
s2.Parent = workspace.FX
services.ts:Create(s2.Mesh, TweenInfo.new(.2), {Scale = Vector3.new(.012, .004, .012)}):Play()
services.ts:Create(s2.Decal, TweenInfo.new(.2), {Transparency = 1}):Play()
services.d:AddItem(s2, .3)
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Include
params.FilterDescendantsInstances = {workspace.Map}
con = services.RS.Heartbeat:Connect(function(dt)
if time() - start >= 2 or eChar.Parent == nil then
con:Disconnect()
return
else
if eChar.HumanoidRootPart.AssemblyLinearVelocity.Magnitude >= 20 then
local dir = data.HitData.CFrame.LookVector * 2
local result = workspace:Raycast(eChar.HumanoidRootPart.Position, dir, params)
if result then
VFX.CreateAndEmit(Assets.VFX.Slam.Slam, CFrame.new(result.Position, result.Position + result.Normal))
VFX.Crator(
{
Position = result.Position,
Radius = 4,
CastDirection = params,
Normal = result.Normal,
Segments = 7,
Layers = 2,
BaseSize = Vector3.new(2, .5, 1),
FlyingRocks = 3
}
)
Auxillary.DestroyTerrain(CFrame.new(result.Position), 2, result)
con:Disconnect()
return
end
end
end
end)
end
end
function DemoSkillset:CombatBegin()
self.ClientData.CooldownManager:Action()
local char = self.User.Character
self.M1Held = true
repeat
if time() - self.LastM1 > ComboCooldown then
self.Combo = 1
end
self.LastM1 = time()
local attachment = Instance.new("Attachment", char.HumanoidRootPart)
local Combo = self.Combo
local Move = "Normal"
local inAir = services.uis:IsKeyDown(Enum.KeyCode.Space)
if char.Humanoid.FloorMaterial == Enum.Material.Air and Combo == 4 then
Move = "Downslam"
self.Animations.Down:Play()
elseif Combo == 4 and inAir then
self.Animations["Uppercut"]:Play()
else
self.Animations["Punch"..self.Combo]:Play()
end
local hitSomeone = false
local hbData = {
CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0, 0, -2),
Size = Vector3.new(3, 3, 4),
IgnoreList = {char},
Func = function(hitData)
if not hitSomeone then
hitSomeone = true
local bv = Instance.new("LinearVelocity")
bv.VectorVelocity = char.HumanoidRootPart.CFrame.LookVector * 25
bv.MaxAxesForce = Vector3.new(999999, 0, 999999)
bv.ForceLimitMode = Enum.ForceLimitMode.PerAxis
bv.Attachment0 = attachment
bv.Parent = char.HumanoidRootPart
services.d:AddItem(bv, .1)
services.d:AddItem(attachment, .1)
end
local sData = {
Skillset = "Demo",
Module = "Skillset",
Action = "Hit",
Data = {HitData = hitData, Combo = Combo, Air = inAir}
}
local repData = {
Skillset = "Demo",
Module = "Skillset",
Action = "Hit",
Data = {HitData = hitData, Combo = Combo, Move = Move, Air = inAir, Char = char}
}
self.ClientData.Server:Fire(sData)
self.ClientData.Replicator:Fire(repData)
end,
}
local LockJump = Instance.new("IntValue")
LockJump.Name = "LockJump"
LockJump.Parent = char.StatusFolder
task.wait(M1WindUp)
if Move == "Downslam" then
local hb = Hitbox.LingeringHitbox(hbData, .1, {Part = char.HumanoidRootPart, Offset = CFrame.new(0, -4, 2) * CFrame.Angles(math.rad(-45), 0, 0)})
else
local hb = Hitbox.LingeringHitbox(hbData, .1, {Part = char.HumanoidRootPart, Offset = CFrame.new(0, 0, -2)})
end
services.d:AddItem(attachment, .3)
if self.Combo == 4 then
services.d:AddItem(LockJump, .6)
local LockWalk = Instance.new("IntValue")
LockWalk.Name = "LockWalk"
LockWalk.Parent = char.StatusFolder
services.d:AddItem(LockWalk, .6)
self.ClientData.CameraShaker:ShakeOnce(12, 8, .2, .2)
self.Combo = 1
task.wait(ComboCooldown)
else
services.d:AddItem(LockJump, .3)
self.ClientData.CameraShaker:ShakeOnce(2, 8, .1, .1)
self.Combo += 1
task.wait(ComboLength)
end
until self.M1Held == false or char.Humanoid.Health <= 0
self.ClientData.CooldownManager:FreeAction()
end
function DemoSkillset:CombatEnd()
if self.M1Held then
self.M1Held = false
end
end
function DemoSkillset.DashEffect(plr : Player, clientData : {}, data : {})
local char = data.Character
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Include
params.FilterDescendantsInstances = {workspace.Map}
for i = 1, 8 do
for i = 1, Auxillary.Random(1, 3) do
local rPos = char.HumanoidRootPart.Position
+ char.HumanoidRootPart.CFrame.RightVector * 1.5
+ Vector3.new(Auxillary.Random(-5, 5)/10, Auxillary.Random(-5, 5)/10, Auxillary.Random(-5, 5)/10)
local lPos = char.HumanoidRootPart.Position
- (char.HumanoidRootPart.CFrame.RightVector * 1.5)
+ Vector3.new(Auxillary.Random(-5, 5)/10, Auxillary.Random(-5, 5)/10, Auxillary.Random(-5, 5)/10)
local rResult = workspace:Raycast(rPos, Vector3.new(0, -10, 0), params)
local lResult = workspace:Raycast(lPos, Vector3.new(0, -10, 0), params)
if rResult then
local pt = Instance.new("Part")
pt.CFrame =
CFrame.new(rResult.Position)
* CFrame.Angles(math.rad(Auxillary.Random(0, 90)), math.rad(Auxillary.Random(0, 90)), math.rad(Auxillary.Random(0, 90)))
VFX.PartAppearanceFromRayResult(rResult, pt)
pt.Size = Vector3.new(0, 0, 0)
services.ts:Create(pt, TweenInfo.new(.3), {Size = Vector3.new(.5, .5, .5)}):Play()
pt.Anchored = true
pt.CanCollide = false
pt.Parent = workspace.FX
task.delay(1, function()
services.ts:Create(pt, TweenInfo.new(.3), {Size = Vector3.new(0, 0, 0)}):Play()
services.d:AddItem(pt, 1)
end)
end
if lResult then
local pt = Instance.new("Part")
pt.CFrame =
CFrame.new(lResult.Position)
* CFrame.Angles(math.rad(Auxillary.Random(0, 90)), math.rad(Auxillary.Random(0, 90)), math.rad(Auxillary.Random(0, 90)))
VFX.PartAppearanceFromRayResult(lResult, pt)
pt.Size = Vector3.new(0, 0, 0)
services.ts:Create(pt, TweenInfo.new(.3), {Size = Vector3.new(.5, .5, .5)}):Play()
pt.Anchored = true
pt.CanCollide = false
pt.Parent = workspace.FX
task.delay(1, function()
services.ts:Create(pt, TweenInfo.new(.3), {Size = Vector3.new(0, 0, 0)}):Play()
services.d:AddItem(pt, 1)
end)
end
end
task.wait(.5/8)
end
end
function DemoSkillset:DashBegin()
if self.ClientData.CooldownManager:OnCooldown("Dash") then
return
end
self.ClientData.CooldownManager:Cooldown("Dash")
self.ClientData.CooldownManager:Action()
local char = self.User.Character
local vector = "Look"
local dir = 1
if services.uis:IsKeyDown(Enum.KeyCode.D) or services.uis:IsKeyDown(Enum.KeyCode.A) then
vector = "Right"
end
if services.uis:IsKeyDown(Enum.KeyCode.A) or services.uis:IsKeyDown(Enum.KeyCode.S) then
dir = -1
end
local repData = {
Skillset = "Demo",
Skill = "Skillset",
Effect = "DashEffect",
Data = {Character = char}
}
self.ClientData.Replicator:Fire(repData)
local attachment = Instance.new("Attachment", char.HumanoidRootPart)
if dir == -1 and vector == "Look" then
self.Animations.BackDash:Play()
local vel = char.HumanoidRootPart.CFrame[vector.."Vector"] * 110 * dir
local bv = Instance.new("LinearVelocity")
bv.VectorVelocity = vel
bv.MaxAxesForce = Vector3.new(999999, 0, 999999)
bv.ForceLimitMode = Enum.ForceLimitMode.PerAxis
bv.Attachment0 = attachment
bv.Parent = char.HumanoidRootPart
services.ts:Create(bv, TweenInfo.new(.4, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {VectorVelocity = vel.Unit * 25}):Play()
task.wait(.4)
self.Animations.BackDash:Play()
vel = char.HumanoidRootPart.CFrame[vector.."Vector"] * 90 * dir
bv.VectorVelocity = vel
services.ts:Create(bv, TweenInfo.new(.4, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {VectorVelocity = vel.Unit * 4}):Play()
task.wait(.4)
bv:Destroy()
attachment:Destroy()
self.ClientData.CooldownManager:FreeAction()
else
if dir == -1 and vector == "Right" then
self.Animations["LeftDash"]:Play()
else
self.Animations[vector.."Dash"]:Play()
end
local bv = Instance.new("LinearVelocity")
bv.VectorVelocity = char.HumanoidRootPart.CFrame[vector.."Vector"] * 110 * dir
bv.MaxAxesForce = Vector3.new(999999, 0, 999999)
bv.ForceLimitMode = Enum.ForceLimitMode.PerAxis
bv.Attachment0 = attachment
bv.Parent = char.HumanoidRootPart
local num = Instance.new("NumberValue")
num.Value = 110
services.ts:Create(num, TweenInfo.new(.4, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {Value = 4}):Play()
local hitDash = false
local con = services.RS.Heartbeat:Connect(function(dt)
bv.VectorVelocity = char.HumanoidRootPart.CFrame.lookVector * num.Value * dir
end)
task.wait(.9)
if vector == "Look" and dir == 1 then
local hbData = {
CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,0,-2),
Size = Vector3.new(3,3,4),
IgnoreList = {char, unpack(Auxillary.Services.cs:GetTagged("Block"))},
Func = function(hitData)
if not hitDash then
hitDash = true
con:Disconnect()
bv:Destroy()
attachment:Destroy()
num:Destroy()
end
local sData = {
Skillset = "Demo",
Module = "Skillset",
Action = "Hit",
Data = {HbData = hbData}
}
local repData = {
Skillset = "Demo",
Module = "Skillset",
Action = "Hit",
Data = {HbData = hbData, Combo = 1}
}
self.ClientData.Server:Fire(sData)
self.ClientData.Replicator:Fire(repData)
end
}
local hb = Hitbox.LingeringHitbox(hbData, .1, {Part = char.HumanoidRootPart, Offset = CFrame.new(0, 0, -2)})
end
task.wait(.3)
if not hitDash then
con:Disconnect()
bv:Destroy()
attachment:Destroy()
num:Destroy()
end
self.ClientData.CooldownManager:FreeAction()
end
end
function DemoSkillset:DashEnd()
end
function DemoSkillset:BlockBegin()
if self.ClientData.CooldownManager:CanAction() then
self.ClientData.CooldownManager:Action()
self.Animations.Block:Play(.2)
local Slow = Instance.new("IntValue")
Slow.Name = "Slow"
Slow.Parent = self.User.Character.StatusFolder
self.Block = Slow
local sData = {
Skillsets = "Demo",
Module = "Skillset",
Action = "BlockBegin",
Data = {}
}
self.ClientData.Server:Fire(sData)
end
end
function DemoSkillset:BlockEnd()
if self.Block then
self.Block:Destroy()
self.Block = nil
self.ClientData.CooldownManager:FreeAction()
self.Animations.Block:Stop(.1)
local sData = {
Skillset = "Demo",
Module = "Skillset",
Action = "BlockEnd",
Data = {}
}
self.ClientData.Server:Fire(sData)
end
end
return DemoSkillset
Another note : The VFX he shows in his video is not present even though I’ve tried to copy the script to the last line.
local SkillsetServer = {}
local Auxillary = require(game:GetService("ReplicatedStorage").Modules.Auxillary.Auxillary)
local services = Auxillary.Services
local CommonMethods = require(services.sss.Modules.Auxillary.CommonMethods)
local Timer = require(services.rs.Modules.Auxillary.Timer)
local VFX = require(services.rs.Modules.Auxillary.VFX)
local Janitor = require(services.rs.Modules.Auxillary.Janitor)
local Hitbox = require(services.rs.Modules.Auxillary.Hitbox)
local Ragdoll = require(services.rs.Modules.Auxillary.Ragdoll)
function SkillsetServer.Hit(p, sData)
if sData.HitData.Hit:HasTag("Block") and sData.Combo ~= 4 then
return
end
sData.HitData.Hit:RemoveTag("Block")
CommonMethods.Damage(p, sData.HitData.Hit, 4)
if sData.HitData.Hit:FindFirstChild("StatusFolder") then
local stun = Instance.new("IntValue")
stun.Name = "Stun"
stun.Parent = sData.HitData.Hit.StatusFolder
services.d:AddItem(stun, 1)
end
if sData.Combo == 4 then
if p.Character.Humanoid.FloorMaterial == Enum.Material.Air then
local attachment = Instance.new("Attachment", sData.HitData.Hit.HumanoidRootPart)
local bv = Instance.new("LinearVelocity")
bv.VectorVelocity = Vector3.new(0, -50, 0)
bv.MaxAxesForce = Vector3.new(999999, 999999, 999999)
bv.Parent = sData.HitData.Hit.HumanoidRootPart
bv.Attachment0 = attachment
bv.ForceLimitMode = Enum.ForceLimitMode.PerAxis
services.d:AddItem(bv, 0.2)
services.d:AddItem(attachment, 0.2)
elseif sData.Air then
local attachment = Instance.new("Attachment", sData.HitData.Hit.HumanoidRootPart)
local bv = Instance.new("LinearVelocity")
bv.VectorVelocity = Vector3.new(0, 50, 0)
bv.MaxAxesForce = Vector3.new(999999, 999999, 999999)
bv.Parent = sData.HitData.Hit.HumanoidRootPart
bv.Attachment0 = attachment
bv.ForceLimitMode = Enum.ForceLimitMode.PerAxis
services.d:AddItem(bv, 0.2)
services.d:AddItem(attachment, 0.2)
else
local attachment = Instance.new("Attachment", sData.HitData.Hit.HumanoidRootPart)
local bv = Instance.new("LinearVelocity")
bv.VectorVelocity = sData.HitData.CFrame.LookVector * 0.25 * 1.5
bv.VectorVelocity += Vector3.new(0, 25 * 1.5, 0)
bv.MaxAxesForce = Vector3.new(999999, 999999, 999999)
bv.Parent = sData.HitData.Hit.HumanoidRootPart
bv.Attachment0 = attachment
bv.ForceLimitMode = Enum.ForceLimitMode.PerAxis
services.d:AddItem(bv, 0.2)
services.d:AddItem(attachment, 0.2)
end
CommonMethods.Ragdoll(sData.HitData.Hit, 1)
else
local attachment = Instance.new("Attachment", sData.HitData.Hit.HumanoidRootPart)
local bv = Instance.new("LinearVelocity")
bv.VectorVelocity = sData.HitData.CFrame.LookVector * 25
bv.VectorVelocity = Vector3.new(0, 25, 0)
bv.MaxAxesForce = Vector3.new(999999, 20, 999999)
bv.Parent = sData.HitData.Hit.HumanoidRootPart
bv.Attachment0 = attachment
bv.ForceLimitMode = Enum.ForceLimitMode.PerAxis
services.d:AddItem(bv, .1)
services.d:AddItem(attachment, .1)
end
function SkillsetServer.BlockBegin(p, sData)
Auxillary.Services.cs:AddTag(p.Character, "Block")
end
function SkillsetServer.BlockEnd(p, sData)
if p.Character:HasTag("Block") then
p.Character:RemoveTag("Block")
end
end
return SkillsetServer