AmPro Battleground Framework Help

You can write your topic however you want, but you need to answer these questions:

  1. I’ve been trying to use AmPro’s Battleground Game Framework.

  2. I’ve been getting errors, but I have no idea what’s wrong.

  3. 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
1 Like

Errors encountered :
20:43:17.545 Players.Roblox_FightingKing.PlayerScripts.Client:126: invalid argument #2 (string expected, got nil) - Client - Client:126, and 20:43:17.507 Requested module experienced an error while loading - Server - Server:39.
AmPro does not have these errors, and the fact that I only need to create Skillset and SkillsetServer module leads me to believe that those modules are why I’m getting these errors. Here are my Client and Server scripts anyways.

---Client
local Auxillary = require(game:GetService("ReplicatedStorage").Modules.Auxillary.Auxillary)
local services = Auxillary.Services

local plr = services.p.LocalPlayer


local c = plr.Character or plr.CharacterAdded:Wait()
local h = c:WaitForChild("Humanoid")

h:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)

local VFX = require(services.rs.Modules.Auxillary.VFX)
local CameraShaker = require(services.rs.Modules.Auxillary.CameraShaker)
local Timer = require(services.rs.Modules.Auxillary.Timer)
local CooldownManager = require(services.rs.Modules.Managers.CooldownManager)
local MovementManager = require(services.rs.Modules.Managers.MovementManager)
local BridgeNet = require(services.rs.Modules.Auxillary.BridgeNet2)
local Interface = require(script.Interface)
local WindShake = require(services.rs.Modules.Auxillary.WindShake)
WindShake:Init()

local Replicator = BridgeNet.ClientBridge("Replicator")
local Server = BridgeNet.ClientBridge("Server")
local DataChange = BridgeNet.ClientBridge("DataChange")
local GetData = BridgeNet.ClientBridge("GetData")

--//Camera Shaking Stuff--
local camera = workspace.CurrentCamera
local oldCamCF
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCFrame)
	if oldCamCF then
		local _,_,z = shakeCFrame:ToOrientation()
		local x,y,_ = shakeCFrame:ToObjectSpace(oldCamCF):ToEulerAnglesXYZ()
		camera.CFrame = camera.CFrame * CFrame.Angles(x,y, -z) 
	end
	oldCamCF = shakeCFrame
end)
camShake:Start()
--//Data that is sent to skillsets
local ClientData = {
	CameraShaker = camShake,
	Mouse = plr:GetMouse(),
	Functions = {},
	Remotes = {["DataChange"] = DataChange,GetData = GetData},
	CooldownManager = CooldownManager.new(plr),
	Replicator = Replicator,
	Server = Server,
	PlayerData = nil,
	MovementManager = nil,
}

ClientData.MovementManager = MovementManager.new(plr, ClientData.CooldownManager)

ClientData.PlayerData = GetData:InvokeServerAsync()
--//Init interface
Interface.Init(ClientData)

--//Skillset
local CurrentSkillsetName = nil --quote quote nil
local CurrentSkillset = {}
ClientData.Skillset = CurrentSkillsetName

function SetUpSkillset(Name)
	CurrentSkillsetName = Name

	for i, Module in pairs(services.rs.Modules.Skillsets[Name]:GetChildren()) do
		local Skill = require(Module)
		if Module.Name == "Skillset" then
			plr.PlayerGui.Main.MainFrame.UltBar.UltName.Text = "None"
			CurrentSkillset.Skillset = require(services.rs.Modules.Skillsets[Name].Skillset).new(plr, ClientData)
			for i, skill in pairs(CurrentSkillset.Skillset.Skills) do
				ClientData.CooldownManager:AddSkill(skill.Name, skill.Cooldown, skill.Key)
			end	
		else
			CurrentSkillset[Skill.Key] = Skill.new(plr, ClientData)
			ClientData.CooldownManager:AddSkill(Skill.Name, Skill.Cooldown, Skill.Key, Skill.UILayoutOrder)
		end
	end
end
function SetDownSkillset()
	ClientData.CooldownManager:ClearSkillset()
	CurrentSkillset = {}
end
SetUpSkillset("Demo") --Base Skillset, Change to whatever character you want
ClientData.Functions.SetUpSkillset = SetUpSkillset

--//Inputs
function handleInputs(input, gpe)
	local convertedInput = ""
	local state = input.UserInputState == Enum.UserInputState.End and "End" or "Begin"
	
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		convertedInput = "M1"
	elseif input.KeyCode.Value >= 48 and input.KeyCode.Value <= 57 then
		convertedInput = tostring(input.KeyCode.Value - 48)
	else
		convertedInput = input.KeyCode.Name
	end
	if plr.Character.Humanoid.Health <= 0 then return end
	if (state == "End" or ClientData.CooldownManager:CanAction()) and ClientData.MovementManager.States.Stun == false and plr.Character.StatusFolder:FindFirstChild("Stun") == nil then
		if CurrentSkillset[convertedInput] then
			CurrentSkillset[convertedInput][state](CurrentSkillset[convertedInput])
		elseif CurrentSkillset.Skillset.Skills[convertedInput] then
			local skill = CurrentSkillset.Skillset.Skills[convertedInput].Name
			CurrentSkillset.Skillset[skill..state](CurrentSkillset.Skillset)
		elseif convertedInput == "LeftShift" then
			ClientData.MovementManager["Sprint"..state](ClientData.MovementManager)
		elseif convertedInput == "H" then
			plr.PlayerGui.Main.Enabled = not plr.PlayerGui.Main.Enabled
		end
	end
end

services.uis.InputBegan:Connect(handleInputs)
services.uis.InputEnded:Connect(handleInputs)

Replicator:Connect(function(repData : any)
	if repData.Custom then
		if repData.Action == "Ragdoll" then
			h:ChangeState(Enum.HumanoidStateType.Physics)
			c.HumanoidRootPart:ApplyAngularImpulse(Vector3.new(Auxillary.Random(-30,30) , Auxillary.Random(-30,30), Auxillary.Random(-30,30)) * c.HumanoidRootPart.AssemblyMass)
			task.wait(repData.Data.Length)
			h:ChangeState(Enum.HumanoidStateType.GettingUp)
		end
	else
		local Skill = require(services.rs.Modules.Skillsets[repData.Skillset][repData.Skill])[repData.Effect](plr, ClientData, repData.Data)
	end
end)

for i, v in pairs(workspace.Map.Destructible:GetChildren()) do
	v:GetAttributeChangedSignal("Broken"):Connect(function()
		if v:GetAttribute("Broken") == true then
			local clone = v:Clone()
			for i, pt in pairs(clone:GetDescendants()) do
				if pt:IsA("BasePart") then
				
					if pt:HasTag("WindShake") then
						pt:RemoveTag("WindShake")
					end
					pt.Massless = true
					pt.CollisionGroup = "Uncollidable"
					--pt.CanCollide = false
					pt.Anchored = false
					pt.AssemblyAngularVelocity = Vector3.new(Auxillary.Random(-90,90),Auxillary.Random(-90,90),Auxillary.Random(-90,90))/100
					pt.AssemblyLinearVelocity = Vector3.new(Auxillary.Random(-10,10),Auxillary.Random(30,100),Auxillary.Random(-10,10))
					task.delay(1, function()
						services.ts:Create(pt, TweenInfo.new(2), {Transparency = 1}):Play()
					end)
				end
			end
			services.d:AddItem(clone, 3)
			clone.Parent = workspace.FX
		else
			for i, pt in pairs(v:GetDescendants()) do
				if pt:IsA("BasePart") then
					local originalCF = pt.CFrame
					local originalTrans = pt.Transparency
					local originalMaterial = pt.Material
					pt.CFrame *= Auxillary.randomCFAngle()
					pt.Size *= 1.3
					pt.Material = Enum.Material.Neon
					pt.Transparency = .8
					services.ts:Create(pt, TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Size = pt.Size/1.3, CFrame = originalCF, Transparency = originalTrans}):Play()
					task.delay(.3, function()
						pt.Material = originalMaterial
					end)
					
				end
			end
			
		end
	end)
end

--//character effects
local function charTilt(char)
	local rootJoint = char:WaitForChild("HumanoidRootPart").RootJoint
	local c1 = rootJoint.C1
	local tiltZ = 0
	local tiltX = 0

	local con

	con = services.RS.Heartbeat:Connect(function(dt)
		if char.Humanoid.Health <= 0 then
			con:Disconnect()
			return
		end

		local dir = char.HumanoidRootPart.CFrame:VectorToObjectSpace(char.HumanoidRootPart.AssemblyLinearVelocity / math.max(char.Humanoid.WalkSpeed, .01))
		tiltZ = math.clamp(Auxillary.LerpWithTime(tiltZ, dir.X,0.12,dt),-0.25,0.25)
		tiltX = math.clamp(Auxillary.LerpWithTime(tiltX, math.abs(math.clamp(dir.Z, -1, 0)), .12, dt),0,0.25)
		rootJoint.C1 = c1 * CFrame.Angles(-tiltX,tiltZ,0)
		
	end)
end

services.p.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		charTilt(char)
	end)
end)

for i, player in pairs(services.p:GetChildren()) do
	if player.Character then
		charTilt(player.Character)
	end
end

plr.CharacterAdded:Connect(function(char)
	SetDownSkillset()
	SetUpSkillset(plr.Skillset.Value)
	c = char
	h = c:WaitForChild("Humanoid")
	h:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
	ClientData.MovementManager:UpdateCharacter(char)
	charTilt(plr.Character)
end)

ClientData.MovementManager:UpdateCharacter(c)

---server
local Auxillary = require(game:GetService("ReplicatedStorage").Modules.Auxillary.Auxillary)
local services = Auxillary.Services

local BridgeNet = require(game:GetService("ReplicatedStorage").Modules.Auxillary.BridgeNet2)
local Replicator = BridgeNet.ServerBridge("Replicator")
local Server = BridgeNet.ServerBridge("Server")
local DataChange = BridgeNet.ServerBridge("DataChange")
local GetData = BridgeNet.ServerBridge("GetData")

local Identifiers = {--bridgenet template for advanced usage
	test = BridgeNet.ReferenceIdentifier("Data"),
	action = BridgeNet.ReferenceIdentifier("Action"),
}

local Ragdoll = require(services.rs.Modules.Auxillary.Ragdoll)
local ProfileService = require(services.sss.Modules.Auxillary.ProfileService)
local ProfileStore = ProfileService.GetProfileStore("PlayerData", {
	Soul = 0,--kills get souls that can be spent if u wanna make a store ig
	LastDay = 0,--track day so we know when to reset
	DailySoul = 0,--track so we can limit soul gain per day(stop afk farmer)
	Kill = 0,--lifetime kill
})

services.ps:RegisterCollisionGroup("Uncollidable")
services.ps:RegisterCollisionGroup("Player")
services.ps:CollisionGroupSetCollidable("Uncollidable", "Player", false)

local LifetimeKillsSB = game:GetService("DataStoreService"):GetOrderedDataStore("lf")

local Profiles = {}

Replicator:Connect(function(p : Player, repData : any)
	repData.Data.Client = p
	Replicator:Fire(BridgeNet.AllPlayers(), repData)
	--Server:Fire(BridgeNet.PlayersExcept({p}), repData)
end)

Server:Connect(function(p : Player, sData : any)
	require(services.sss.Modules.Skillsets[sData.Skillset][sData.Module.."Server"])[sData.Action](p, sData.Data)
end)

DataChange:Connect(function(p : Player, sData : {any})
	require(services.sss.Modules.Data[sData.Action])(p, sData.Data, Profiles[p].Data)
end)
require(Auxillary.Services.sss.Modules.Auxillary.CommonMethods).Profiles = Profiles
DataChange.OnServerInvoke = function(p, sData)
	return require(services.sss.Modules.Data[sData.Action])(p, sData.Data, Profiles[p].Data)
end
GetData.OnServerInvoke = function(p :Player, sData : {any})
	return Profiles[p].Data
end

services.p.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		services.RS.Heartbeat:Wait()
		character.Parent = workspace.Humanoids
		
		local meshhead = script.Head:Clone()
		meshhead.CFrame = character:WaitForChild("Head").CFrame
		character.Torso.Neck.Part1 = meshhead

		meshhead.Color = character.Head.Color
		meshhead.face.Texture = character.Head.face.Texture
		character.Head:Destroy()
		meshhead.Parent = character
		
		character.PrimaryPart = character.HumanoidRootPart
		local humanoid = character.Humanoid
		humanoid.BreakJointsOnDeath = false
		humanoid.RequiresNeck = false

		local clones = {}
		for _, v in ipairs(services.rs.Modules.Auxillary.Ragdoll.RagdollParts:GetChildren()) do
			clones[v.Name] = v:Clone()
		end
		
		for _, v in pairs(character:GetChildren()) do
			if v:IsA("BasePart") then
				v.CollisionGroup = "Player"
			end
		end

		local folder1 = Instance.new("Folder")
		folder1.Name = "RagdollConstraints"
		for _, v in pairs(clones) do
			if v:IsA("Attachment") then
				v.Parent = character[v:GetAttribute("Parent")]
			elseif v:IsA("BallSocketConstraint") then
				v.Attachment0 = clones[v:GetAttribute("0")]
				v.Attachment1 = clones[v:GetAttribute("1")]
				v.Parent = folder1
			end
		end
		folder1.Parent = character

		local folder2 = Instance.new("Folder")
		folder2.Name = "Motors"
		local value
		for _, v in ipairs(character.Torso:GetChildren()) do
			if v:IsA("Motor6D") then
				value = Instance.new("ObjectValue")
				value.Value = v
				value.Parent = folder2
			end
		end
		
		folder2.Parent = folder1
		
		local StatusFolder = Instance.new("Folder")
		StatusFolder.Name = "StatusFolder"
		StatusFolder.Parent = character

		local au = Instance.new("ObjectValue")
		au.Name = "Aura"
		au.Value = nil
		au.Parent = character
	end)
	local UserProfile = ProfileStore:LoadProfileAsync("Player_" .. player.UserId)
	
	if UserProfile ~= nil then
		UserProfile:AddUserId(player.UserId) -- GDPR compliance
		UserProfile:Reconcile() -- Fill in missing variables from ProfileTemplate (optional)
		UserProfile:ListenToRelease(function()
			Profiles[player] = nil
			-- The profile could've been loaded on another Roblox server:
			player:Kick()
		end)
		if player:IsDescendantOf(services.p) == true then
			Profiles[player] = UserProfile
			UserProfile.Data.Soul = 1000
			local day = DateTime.now():ToUniversalTime()
			day = day.Day + day.Year
			if UserProfile.Data.LastDay ~= day then
				UserProfile.Data.LastDay = day
			end
			--UserProfile.Data.Accessory = {}
			print("LOADED PROFILE")
			--print(UserProfile.Data, "p")
		else
			-- Player left before the profile loaded:
			UserProfile:Release()
		end
	else
		-- The profile couldn't be loaded possibly due to other
		--   Roblox servers trying to load this profile at the same time:
		player:Kick() 
	end	
	
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local gold = Instance.new("IntValue")
	gold.Name = "Kills"
	gold.Value = UserProfile.Data.Kill
	gold.Parent = leaderstats
	
	local UltimateBar = Instance.new("NumberValue")
	UltimateBar.Name = "Ultimate"
	UltimateBar.Value = 0
	UltimateBar.Parent = player
	
	do
		local a = Instance.new("NumberValue")
		a.Name = "LastCombat"
		a.Value = 0
		a.Parent = player
	end
	do
		local a = Instance.new("StringValue")
		a.Name = "Skillset"
		a.Value = "Demo"
		a.Parent = player
	end
	
	--task.spawn(function()
	--	services.RS.Heartbeat:Connect(function(dt)
	--		if UltimateBar.Value ~= 0 and UltimateBar.Value ~= 100 then
	--			UltimateBar.Value = math.max(UltimateBar.Value - dt, 0)
	--		end
	--	end)
		
	--end)
	
	local Character = Instance.new("StringValue")
	Character.Name = "Character"
	Character.Value = "Demo"
	Character.Parent = player
end)
services.p.PlayerRemoving:Connect(function(Player)
	if Profiles[Player] then
		task.spawn(function()
			local val = Profiles[Player].Data.Kill
			LifetimeKillsSB:UpdateAsync(Player.UserId, function(oldval,datastorekeyinfo : DataStoreKeyInfo)
				return val
			end)
		end)
		Profiles[Player]:Release()
	end
end)
function updateleaderboard()
	local pages = LifetimeKillsSB:GetSortedAsync(false, 50,1, 10e30)

	for i, v in workspace.Leaderboard.SurfaceGui.Scoreboard.Body:GetChildren() do
		if v:IsA("GuiBase") and v.Visible then
			v:Destroy()
		end
	end
	local top = pages:GetCurrentPage()

	for i , v in ipairs(top) do
		local userid =tonumber(v.key)
		local kills = v.value
		local s, PlayerInfo = pcall(function() 
			return game:GetService("UserService"):GetUserInfosByUserIdsAsync({userid})[1]
		end)
		local username,name
		if PlayerInfo then
			username = PlayerInfo.Username
			name = PlayerInfo.DisplayName
			
		else
			username = "error"
			name = 'error'
		end
		local clone= workspace.Leaderboard.SurfaceGui.Scoreboard.Body.PlayerCardTemp:Clone()
		clone.NameFrame.NameLabel.Text = username
		clone.NameFrame.NameLabel.NameLabel.Text = "@"..name
		clone.Num.Text = kills
		clone.NameFrame.PlaceText.Text = i
		local s, image = pcall(function()
			return Auxillary.Services.p:GetUserThumbnailAsync(userid, Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size48x48)
		end)
		clone.NameFrame.Goat.Image = image
		clone.Parent = workspace.Leaderboard.SurfaceGui.Scoreboard.Body
		clone.Visible = true
	end
end
updateleaderboard()


for i, character in pairs(workspace.Humanoids:GetChildren()) do
	Ragdoll:Setup(character)
end

for i, part in pairs(workspace.Map.Breakable:GetDescendants()) do
	part:SetAttribute("Breakable", true)
end
1 Like

is there anything wrong with the system? That doesn’t work correctly? If there is I’d rewatch the tutorial.