Introduction:
Hello developers!
Another day, another bug found.
Where should I start, alright so a couple days ago I’ve been working on this Damage Mutliplying script I’ve made myself, it might get a bit more confusing as you continue to read, so let me explain with more details. There are two abilities in the game, “The Main Ability”, and the “Sub-Ability”, the main ability has the most keys, like “e, r, t, y, f, g, h, , z, v, b, etc…” and the Sub-Ability only has 3 moves, “j, k, l”. Let me explain more about these two.
Main Ability- Obtainable from completing certain quests and obtaining items. You can’t get rid of it as it is part of your main gameplay. You can change it though.
Sub-Ability- As it says in the name, it is basically like a set of moves that helps you with a combo. You can get rid of this ability or get another sub-ability the same way you gain the main abilities. Heres are some examples: {Karate, Samurai, Superhuman, FireMagic, IceMagic, etc.}.
I’ve thought of making a Damage Multiplying script that works with both the Main-Ability and the Sub-Ability. For example, a certain Sub-Ability increases your damage multiplier. And that’s exactly what I did, it was not an easy task, as easy it may seem, it’s incredibly hard to create something that I’ve never made before.
The Problem:
Of course, when you’re making something new you would always face a problems, it happens to the best of us. After encountering this bug, I tried my hardest to fix it, but to no evail, I’ve started losing motivation. I’ve made scripts like, checking if the value of the damage multiplier is 0, or checking if the value of it has changed…
– Script inside the damage multiply value –
function Check()
if script.Parent.Value == 0 then
script.Parent.Value = 1
print("it broke again bruh")
task.wait(5)
end
end
script.Parent.Changed:Connect(function(NewValue)
Check()
end)
–The damage multiplier checking thing…–
local DamageMultiplier = Chr:WaitForChild("Values").DamageMultiplier
local damagecheckcd = false
DamageMultiplier.Changed:Connect(function(NewValue)
if damagecheckcd == true then
return
end
local oldvalue = DamageMultiplier.Value
damagecheckcd = true
if NewValue >= 1 then
NumberChangeEvent:FireServer(NewValue)
task.wait(30)
damagecheckcd = false
else
end
end)
If you were wondering what the numberchangeevent thing is, it’s just a serverscript that changes the value of the damage multiplier. I know, I know, I’m an idiot, and it’s unorganised, but it’s the best I can do as an amatuer scripter.
There’s also a awakening move that (like i said), buffs your damage by increasing the damage multiplier,:
–The Move–
--// Demon Back \\--
function Mybackhasbeenbuiltlikeademon()
if plr.SkillsData.SkillThree.Value then
local TS = game:GetService("TweenService")
--// Cooldown and Performing Check\\--
if DemonBackCD.Value == true or PerformingAction.Value == true or Stunned.Value == true then return end
--// Applying the Changes\\--
IFrameandPerformance:FireServer("PerformingAction", true)
IFrameandPerformance:FireServer("IFrame", "3")
CooldownEvent:FireServer("Cooldown", DemonBackCD, true)
IFrameandPerformance:FireServer("PerformingAction", false)
NumberChangeEvent:FireServer("1.2")
Demonbackevent:FireServer("Transform")
coroutine.resume(coroutine.create(function()
wait(3)
BattleFieldOst:Play()
BattleFieldOst.Volume = 4
end))
task.wait(60)
coroutine.resume(coroutine.create(function()
local Tween = TS:Create(BattleFieldOst, TweenInfo.new(4, Enum.EasingStyle.Linear), {Volume = 0})
Tween:Play()
Tween.Completed:Wait()
BattleFieldOst:Stop()
end))
Undemonbackevent:FireServer()
task.wait(100)
--// Cooldown\\--
coroutine.resume(coroutine.create(function()
task.wait(6)
CooldownEvent:FireServer("Cooldown", DemonBackCD, false)
end))
end
end
Yikes, so if you were wondering about the damage script, there are two damage scripts actually, one is located inside the local script (aka the ability script), and the other is a serverscript.
— Local Script –
-- Damage 1
function damage(partoz, partcfr, magn, dmg, debtim, debtime, bodyfdire, effect, grow, color, soundid, volume)
for _, guy in pairs(workspace.Living:GetChildren()) do
--// Camera Manipulation \\--
local camera = workspace.CurrentCamera
local CameraShaker = require(game.ReplicatedStorage.Modules.CameraShaker)
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value,function(shakeCFrame)
camera.CFrame = camera.CFrame * shakeCFrame
end)
camShake:Start()
if partoz.Anchored == true then return end
if guy:FindFirstChild("Humanoid") and guy:FindFirstChild("HumanoidRootPart") and guy ~= Chr and magn > (guy:FindFirstChild("HumanoidRootPart").Position - partoz.Position).magnitude and guy:FindFirstChild("HumanoidRootPart"):FindFirstChild("AlreadyHit") == nil then
do
if partoz.Anchored then return end
local humz = guy:FindFirstChild("Humanoid")
local horp = guy:FindFirstChild("HumanoidRootPart")
damageevent:FireServer(humz, partcfr, dmg*DamageMultiplier.Value, debtime, bodyfdire, soundid, volume, "No")
camShake:Shake(CameraShaker.Presets.Bump)
BlockBreakEvent:FireServer(guy)
local db = Instance.new("StringValue")
db.Name = "AlreadyHit"
db.Parent = horp
task.wait(debtim)
db:Destroy()
end
end
end
end
The "damageevent:FireServer(humz, partcfr, dmgDamageMultiplier.Value, debtime, bodyfdire, soundid, volume, “No”)" is the script that fires the event. You can also see the dmgDamageMultiplier.Value, this is where is multiplies the original dmg with the damagemultiplier.
And this is the serverscript:
--// -----------------------\\--
--// Standless Hitbox System \\--
--//-------------------------\\--
game.ReplicatedStorage.Main.Abilities.Damages.Baki.HitboxEvent.OnServerEvent:Connect(function(player, humz, partcfr, dmg, debtime, bodyfdire, soundid, volume)
--// Necessary Variables \\--
local chr = humz.Parent
local MainCHR = player.Character
local DamageMultiplier = MainCHR.Values.DamageMultiplier
local head = chr["Head"]
local enemychr = humz.Parent
--// Sound
coroutine.resume(coroutine.create(function()
local sfx = Instance.new("Sound")
sfx.Volume = volume
if chr.Values.Guard.Value == true then
sfx.SoundId = "rbxassetid://6349432699"
else
sfx.SoundId = "rbxassetid://"..soundid
end
sfx.Parent = head
sfx:Play()
game.Debris:AddItem(sfx, 1.4)
end))
--// Iframe and block thing \\--
if chr.Values.IFrame.Value == true then return end
--// If enemy is not guarding then
if chr.Values.Guard.Value == false then
--// Timestop lol \\--
repeat
task.wait()
until game.Lighting.Pause.Value == false
humz:TakeDamage(dmg)
MainCHR.Values.ComboCount.Value = MainCHR.Values.ComboCount.Value + 1
--// Animation Playing \\--
coroutine.resume(coroutine.create(function()
local math = math.random(1 , 3)
local animation = Instance.new("Animation", enemychr.HumanoidRootPart)
if math == 1 then
animation.AnimationId = "rbxassetid://8197918420"
elseif math == 2 then
animation.AnimationId = "rbxassetid://8197919475"
elseif math == 3 then
animation.AnimationId = "rbxassetid://8197920658"
end
local anima = humz:LoadAnimation(animation)
anima:Play()
task.wait(0.5)
anima:Stop()
game.Debris:AddItem(animation, 1)
end))
--// Hit Effect \\--
local enemyhrp = chr:FindFirstChild("HumanoidRootPart")
local effectmodule = require(game.ServerStorage.EffectHit:WaitForChild("BakiHitEffect"))
local amount = nil
amount = math.random(1, 2)
if amount == 1 then
effectmodule.Gore1(enemyhrp)
elseif amount == 2 then
effectmodule.Gore2(enemyhrp)
end
--// Elseif the enemy was guarding then
elseif chr.Values.Guard.Value == true then
--// Sparks
local ClashParticle = script.Sparks:Clone()
ClashParticle.Parent = enemychr.HumanoidRootPart
ClashParticle:Emit(math.random(15,25))
game.Debris:AddItem(ClashParticle,0.6)
--// Red Sparks
local ClashParticle2 = script.RedSparks:Clone()
ClashParticle2.Parent = enemychr.HumanoidRootPart
ClashParticle2:Emit(math.random(15,25))
game.Debris:AddItem(ClashParticle,0.6)
--// Block Animation
local animation = Instance.new("Animation", enemychr.HumanoidRootPart)
repeat
task.wait()
until game.Lighting.Pause.Value == false
--// Damage And Animation Playing
humz:TakeDamage(dmg / 100 * chr.Values.GuardReduction.Value)
animation.AnimationId = "rbxassetid://8460376258"
local anima = humz:LoadAnimation(animation)
anima:Play()
task.wait(0.5)
anima:Stop()
game.Debris:AddItem(animation, 1)
end
--// Knockback Function
local function knockback()
if chr.Values.Guard.Value == true then return end
local boopyve = Instance.new("BodyVelocity")
boopyve.MaxForce = Vector3.new(100000, 100000, 100000)
boopyve.P = math.huge
boopyve.Velocity = bodyfdire
boopyve.Parent = chr.HumanoidRootPart
game.Debris:AddItem(boopyve, debtime)
end
--// Knockback Play
knockback()
end)
However, when I use awakening, the damage multiplier ceases to work, the punches deals no damage, and this error message keeps on popping up.
“attempt to index number with ‘Value’”
Welp, that’s all of the information I needed to give, I hope I can fix this issue eventually with the help of the devforum users.