Sorry for the late reply, I appreciate the help unfortunately it doesn’t work
Could the issue be with how I’m setting the attribute?
local uis = game:GetService("UserInputService")
local rs = game:GetService("ReplicatedStorage")
local player = game:GetService("Players").LocalPlayer
local chr = player.Character
local DashAttackEvent = rs:WaitForChild("DashAttackEvent")
local hum = chr:WaitForChild("Humanoid")
local stunnedevent = rs:WaitForChild("StunnedEvent")
local ListOfWeapons = {
"BasicSword",
"RengokuSword",
"PlaceHolder1",
}
local module = require(rs:WaitForChild("Modules").CombatSystemModule)
local CombatNum = 1
local debounce = false
local candashattack = true
uis.InputBegan:Connect(function(input,e)
if e then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
for i,v in player.Character:GetChildren() do
if table.find(ListOfWeapons, v.Name) and v:IsA("MeshPart") and debounce == false and chr:GetAttribute("isDashing") == false and chr:GetAttribute("Stunned") == false and chr:GetAttribute("IsBlocking") == false and chr:GetAttribute("IsAttacking") == false and chr:GetAttribute("Parried") == false then
debounce = true-- assuming this is the problem, as it may of let other MeshParts through
module.CombatSystem(player, CombatNum)
CombatNum += 1
if CombatNum > 4 then
CombatNum = 1
end
local hitboxCFrame = chr.PrimaryPart.CFrame * CFrame.new(0,0,-2.5)
local hitboxSize = Vector3.new(5,5,5)
local damage = 13
local hitbox = rs.Hitbox:Clone()
hitbox.Parent = workspace
hitbox.CFrame = hitboxCFrame
hitbox.Size = Vector3.new(hitboxSize, hitboxSize, hitboxSize)
local hitcontent = workspace:GetPartBoundsInBox(hitboxCFrame, hitboxSize)
local hitlist = {}
for _,v in pairs(hitcontent) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= chr and not table.find(hitlist, v.Parent) then
table.insert(hitlist, v.Parent)
v.Parent.Humanoid:TakeDamage(damage)
v.Parent:SetAttribute("Stunned", true)
end
end
----for i,v in pairs(hitlist) do
---- print(v.Name)
---- if v:FindFirstChild("Blocking") then
---- v:FindFirstChild("Blocking"):Destroy()
---- end
--end
task.wait(0.5)
debounce = false
return
end
if table.find(ListOfWeapons, v.Name) and v:IsA("MeshPart") and chr:GetAttribute("Stunned") == false and chr:GetAttribute("isDashing") == true and candashattack == true then
candashattack = false--
chr:SetAttribute("IsAttacking", true)
local dashattackanim = game:GetService("ReplicatedFirst").Animations.DashAttackAim
local dashattacktrack = hum:LoadAnimation(dashattackanim)
dashattacktrack:Play()
dashattacktrack:GetMarkerReachedSignal("SpawnHitBoxEvent"):connect(function()
CombatNum += 1
DashAttackEvent:FireServer()
if CombatNum > 4 then
CombatNum = 1
end
local hitboxCFrame = chr.HumanoidRootPart.CFrame * CFrame.new(0,0,0)
local hitboxSize = Vector3.new(10,5,20)
local damage = 18
local hitbox = rs.Hitbox:Clone()
hitbox.Parent = workspace
hitbox.CFrame = hitboxCFrame
hitbox.Size = Vector3.new(hitboxSize, hitboxSize, hitboxSize)
local hitcontent = workspace:GetPartBoundsInBox(hitboxCFrame, hitboxSize)
local hitlist = {}
for _,v in pairs(hitcontent) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= chr and not table.find(hitlist, v.Parent) then
table.insert(hitlist, v.Parent)
v.Parent.Humanoid:TakeDamage(damage)
v.Parent:SetAttribute("Stunned", true)
end
end
end)
task.wait(1)
chr:SetAttribute("IsAttacking", false)
----for i,v in pairs(hitlist) do
---- print(v.Name)
---- if v:FindFirstChild("Blocking") then
---- v:FindFirstChild("Blocking"):Destroy()
---- end
--end
task.wait(4)
candashattack = true
return
end
end
end
end)
edit: sorry in advanced, ik the code is hell to read