So im making a combat system which is gonna be server sided, And im trying to figure out what to use for Combo Counters. If you dont understand what im saying is that i want my combat system non exploitable and i want to keep it really secure. And For Combo Counters I have no idea. If you are confused on what im trying to say about Combo Counters then let me explain. I press MouseButton1, My Combo is 1 It Increases to 2. I want to achieve that. But in order i dont want to use variables like local Combo = 1 and stuff. I want to use another method i cant find a good method to use. Any Help is Greatly Appreciated!
The only other way that I can think of is to use objects like IntValue or NumberValue.
I dont really like using those. they’re just boring to use idk why
You can make a intvalue instance inside the player and every time it gets updated you wait a certain time before destroying it
just use any random ass number variable
local combocounter = 0
wdym boring. Both this and a basic variable pretty much accomplish what you are looking for.
Use intvalue or numbervalue, it’s the only way to keep it safe lol
you can use attributes if you want to be fancy
can i ask what you mean by keeping it safe?
I made a mistake but IntValues and NumberValues are kept in scripts or somewhere else, (only way to keep them safe are keeping them in a serverscriptservice script), numbers inside of localscripts/scripts like:
local test = 1
are safe because they are kept inside scripts and cannot be accessed.
Alright alright, I found the solution. I used attributes and made a attribute manager which checks when a child is added and it sets the attributes to that child. and it checks for a humanoid inside it if it doesnt have a humanoid then it wont set the attributes. This is also really secure to use Here is the full code:
local Packages = rp:WaitForChild("Packages")
local Knit = require(Packages.Knit)
local AttributeManager = Knit.CreateService {
Name = "AttributeManager",
Client = {},
}
function AttributeManager:KnitInit()
return warn(debug.traceback(script.Name.." Initialised..."))
end
function AttributeManager:KnitStart()
return warn(debug.traceback(script.Name.." Started!"))
end
local names = {
"Combo",
"Attacking",
"Blocking"
}
local valuetable = {
["Combo"] = 1,
["Attacking"] = false,
["Blocking"] = false
}
for i, child in pairs(workspace:GetDescendants()) do
local hum = child:FindFirstChildOfClass("Humanoid")
if hum then
local Player = game.Players:GetPlayerFromCharacter(child)
if not Player then
error(debug.traceback(child.." Is not a Player!"))
return
end
child:SetAttribute("Combo", valuetable.Combo)
child:SetAttribute("Attacking", valuetable.Attacking)
child:SetAttribute("Blocking", valuetable.Blocking)
AttributeManager[child] = {
Combo = child:GetAttribute("Combo"),
Attacking = child:GetAttribute("Combo"),
Blocking = child:GetAttribute("Blocking"),
}
end
end
workspace.ChildAdded:Connect(function(child)
local hum = child:FindFirstChildOfClass("Humanoid")
if hum then
local Player = game.Players:GetPlayerFromCharacter(child)
if not Player then
error(debug.traceback(child.." Is not a Player!"))
return
end
child:SetAttribute("Combo", valuetable.Combo)
child:SetAttribute("Attacking", valuetable.Attacking)
child:SetAttribute("Blocking", valuetable.Blocking)
AttributeManager[child] = {
Combo = child:GetAttribute("Combo"),
Attacking = child:GetAttribute("Combo"),
Blocking = child:GetAttribute("Blocking"),
}
end
end)
function AttributeManager:SetAttribute(child, attributename: string?, value: any?)
local Attribute = child:GetAttribute(attributename)
if not Attribute then
error(debug.traceback("Attribute by the name:"..Attribute.." Doesnt exist or cant find it!"))
return
end
end
workspace.ChildRemoved:Connect(function(child)
local hum = child:FindFirstChildOfClass("Humanoid")
if hum then
local Player = game.Players:GetPlayerFromCharacter(child)
if not Player then
error(debug.traceback(child.." Is not a Player!"))
return
end
child:SetAttribute("Combo", nil)
child:SetAttribute("Attacking", nil)
child:SetAttribute("Blocking", nil)
AttributeManager[child] = nil
end
return warn("Child removed so removed all the Child's values!")
end)
return AttributeManager
That would be the solution, But i want to use it for other stuff. For Example:
I have a sword equipped i M1 3 times and i switch back to my combat. The combo count will start all over again bc the combo counts in the sword script is a whole another thing
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.