hello im amaro, and im having this type of issue for now years, and idk how to solved, and i think is because of how my skills on my game (is a combat system btw) call the fireevents.
and maybe i should organize and change the way of how to call the functions of the server.
here is how is manage the combat system on my game, by the time im posting this
*LOCAL SCRIPT OF THE SKILL:
here gets the input and fires a remote event inside of this local script
example:
local move = script:WaitForChild("Attack")
local UIS = game:GetService("UserInputService")
local first = Enum.KeyCode.One
local second = Enum.KeyCode.Two
local third = Enum.KeyCode.Three
UIS.InputBegan:Connect(function(input,gameprocessed)
if gameprocessed == true then return end
if checked.canattackb(plr) then return end
if input.KeyCode == first then
move:FireServer(first)
elseif input.KeyCode == second then
move:FireServer(second)
elseif input.KeyCode == third then
move:FireServer(third)
end
end)
*REMOTE EVENT INSIDE OF LOCAL SCRIPT:
a remote event, inside of this remoteevent, there a script calling “onserverevent”,
basicly this script all it does is calls a module script having all the setup of the moveset of the skill
example:
script.Parent.OnServerEvent:Connect(function(player, key, c--this is add to put a variable like true or false stuff)
local myModule = require(game.ServerScriptService.Main.damages.MoveSet)
local myNewModule = myModule.new(player)
if key == Enum.KeyCode.One then
myNewModule:create("Street", "Kick")
elseif key == Enum.KeyCode.Two then
myNewModule:create("Street", "PunchDown")
elseif key == Enum.KeyCode.Three then
myNewModule:create("Street", "HeadPunch")
end
end)
*MODULE SCRIPT “MOVESETS”:
this module script have all moveset of the skill in a table inside of a table with functions, uses metatable tho.
example:
local module = {}
module.__index = module
--btw all these variable like "dmg" or other stuff are function inside of this module script are the set up for each function for the moveset for the skill, is something that could be inside tho on the local script of the skill, but i dont really know if make any change, but if this method of doing the setup for the moveset of attack for the skill makes the game laggy, pls tell me
local basicsfolder = script.Basics
local somefunctions = script.SomeFunctions
local projectiles = script.Projectiles
local anchor = require(basicsfolder.Anchor)
local attributechange = require(basicsfolder.AttributeChange)
local visible = require(basicsfolder.Visible)
local transparency = require(basicsfolder.Transparency)
local trail = require(basicsfolder.Trail)
local standAura = require(basicsfolder.StandAura)
local valuechange = require(basicsfolder.ValueChange)
local velocity = require(basicsfolder.VelocityStuff)
local indicators = require(somefunctions.Indicators)
local coldowns = require(somefunctions.CooldownGuis)
local bareffect = require(somefunctions.beeffect)
local barragehandler = require(somefunctions.Barragehanler)
local projectilehandler = require(projectiles.moduleprojecttest)
local donutt = require(somefunctions.DonutTw)
local timefroze = require(somefunctions.timefrozeinvoque)
--defaultmoves
local m1modul = require(script.m1_move)
local blockmold = require(script.block)
local visualizerremote = game:GetService("ReplicatedStorage").Combat.Client_effect
local cooldowns = {}
local loadedAnimations = {} -- store animations here
local dmg = require(script.Damage)
local run = game:GetService("RunService")
function module.new(player)
local chr = player.Character
local human = chr.Humanoid
local newmodule = {
["Street"] = {
["Kick"] = function()
--coding
end;
["PunchDown"] = function()
--coding
end;
["HeadPunch"] = function()
--coding
};
}
setmetatable(newmodule, module)
return newmodule
end
function module:create(name, attack, val)
self[name][attack](val)
end
return module
now that is how kinda is organized the combat system, and plus maybe how is the local script for the skill put it in the player backpack can cause laggy tho, but maybe i see that later. for now pls give an advice or recomendation for the organization or a method for better performance, i beg for anyone to help me this very long problem that is on by years on my project
and for those who think im trying to people code my game for me, IM NOT DOING THAT, IM JUST TRYING TO GET RECOMENDATIONS, ANY ADVICE, OR JUST SOMETHING ELSE