To summarize, I’m creating a fighting game, and just now recently, ALL moves hit events refuse to work, even in old versions that I KNOW for a fact worked in the past. Is this a roblox bug? If so then I really hope so, since I’ve spent days working on this, and just now it wants to break. Any information or help would be greatly appreciated!
Here’s how my attacking system works: I basically have a local script for inputs, obviously and fires 2 different remote events, the swing, and the hit. Why two? It’s because I use client hitboxes for responsiveness (I already have an anti-exploit system in place.) And I use a module script I made so I can reuse various functions, such as a hitbox creation function.
For this I’ll use one of the moves as an example:
The Local Script:
--//Hard Punch
local usedHardPunchLast = 0
uis.InputBegan:Connect(function(key, busy)
if busy then return end
if key.KeyCode == Enum.KeyCode.R and tick() - usedHardPunchLast > 8.5 and not cs:HasTag(player, "CantAttack") and not char:FindFirstChild('Stun') and canMove then
usedHardPunchLast = tick()
canMove = false
task.delay(.1, function()
canMove = true
end)
game:GetService('ReplicatedStorage').Remotes.Attacks.Sp.HardPunch.Swing:FireServer(player)
task.wait(.4)
local hitbox = reusedFunctions.createHitbox(char, Vector3.new(5,6,5.5), CFrame.new(0,0,-3), .2)
hitbox.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') and hit.Parent ~= char then
hitbox.CanTouch = false
game:GetService('ReplicatedStorage').Remotes.Attacks.Sp.HardPunch:FireServer(hit)
end
end)
end
end)
The Module Script that holds the hitbox function:
--//Create Hitbox Function
module.createHitbox = function (plrChar, size, offset, duration)
local hitbox = Instance.new("Part", workspace.Storage.Hitboxes)
hitbox.Size = size
hitbox.Transparency = .5
hitbox.Color = Color3.new(1, 0, 0.0156863)
hitbox.Material = Enum.Material.ForceField
hitbox.CanCollide = false
hitbox.Massless = true
if plrChar then
hitbox.CFrame = plrChar.HumanoidRootPart.CFrame * offset
local hbWeld = Instance.new("WeldConstraint", hitbox)
hbWeld.Part0 = plrChar.HumanoidRootPart
hbWeld.Part1 = hitbox
end
game.Debris:AddItem(hitbox, duration)
return hitbox
end
The swing server script located in serverscriptservice:
local remote = game:GetService('ReplicatedStorage').Remotes.Attacks.Sp.HardPunch.Swing
local cs = game:GetService('CollectionService')
remote.OnServerEvent:Connect(function(player)
if not cs:HasTag(player, "swingHardPunchCooldown") then
cs:AddTag(player, "swingHardPunchCooldown")
cs:AddTag(player, "CantAttack")
task.delay(8.5, function()--Subtract based on windup
cs:RemoveTag(player, "swingHardPunchCooldown")
end)
local animation = player.Character.Humanoid:LoadAnimation(script.Animation)
animation:Play()
local oraSound = Instance.new("Sound", player.Character.HumanoidRootPart)
oraSound.SoundId = "rbxassetid://5577919356"
oraSound.Volume = .5
oraSound.TimePosition = .1
oraSound:Play()
game.Debris:AddItem(oraSound, 5)
player.Character.Humanoid.WalkSpeed = 8
task.wait(.4)
player.Character.Humanoid.WalkSpeed = player.Character.Values.TrueWalkSpeed.Value
cs:RemoveTag(player, "CantAttack")
end
end)
The actual hit action serverscript parented to the swing script in serverscriptservice:
local remote = game:GetService('ReplicatedStorage').Remotes.Attacks.Sp.HardPunch
local cs = game:GetService('CollectionService')
local reusedFunctions = require(game:GetService('ReplicatedStorage').Modules.ReusedFunctions)
remote.OnServerEvent:Connect(function(player, hit)
if not cs:HasTag(player, "hardPunchCooldown") and (player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-3).Position - hit.Parent.HumanoidRootPart.Position).magnitude < 7 and not player.Character:FindFirstChild('Stun') and player.Values.Stand.Value == "Sp" then --Preventing stand, cooldown, stun, and range hackers.
cs:AddTag(player, "hardPunchCooldown")
task.delay(8.7, function()--Subtract based on windup
cs:RemoveTag(player, "hardPunchCooldown")
end)
if hit.Parent:FindFirstChild('IFrame') then return end --Return ends (Put find stun if it's cancelable)
reusedFunctions.runParry(player.Character, hit.Parent) --Parrying
if hit.Parent:FindFirstChild('Parrying') then return end --Cancel dmg for parry
if not hit.Parent:FindFirstChild('Blocking') then
reusedFunctions.damage(14, hit.Parent, player.Character)
local stun = Instance.new("BoolValue", hit.Parent)
stun.Name = "Stun"
game.Debris:AddItem(stun, .5)
local hitSound = Instance.new('Sound', hit.Parent.HumanoidRootPart)
hitSound.SoundId = "rbxassetid://8701825353"
hitSound.Volume = .5
hitSound:Play()
game.Debris:AddItem(hitSound, 3)
local anim = Instance.new('Animation', hit.Parent.HumanoidRootPart)
anim.AnimationId = "rbxassetid://12295728412"
local animtrack = hit.Parent.Humanoid:LoadAnimation(anim):Play()
anim:Destroy()
local bv = Instance.new('BodyVelocity', hit.Parent.HumanoidRootPart)
bv.Velocity = player.Character.HumanoidRootPart.CFrame.LookVector * 70
bv.MaxForce = Vector3.new(99999,99999,99999)
game.Debris:AddItem(bv, .4)
local bv2 = Instance.new('BodyVelocity', player.Character.HumanoidRootPart)
bv2.Velocity = player.Character.HumanoidRootPart.CFrame.LookVector * 15
bv2.MaxForce = Vector3.new(99999,99999,99999)
game.Debris:AddItem(bv2, .2)
local hitVFX1 = game:GetService('ReplicatedStorage').VFX.HeavyVFX1:Clone()
hitVFX1.Parent = workspace.Storage.Effects
hitVFX1.CFrame = hit.Parent.Torso.CFrame
local hitVFX1Weld = Instance.new('WeldConstraint', hitVFX1)
hitVFX1Weld.Part0 = hit.Parent.Torso
hitVFX1Weld.Part1 = hitVFX1
for _, v in pairs(hitVFX1:GetDescendants()) do
if v:IsA('ParticleEmitter') then
v:Emit(5)
end
end
game.Debris:AddItem(hitVFX1, 2)
else
reusedFunctions.blockBreak(player.Character, hit.Parent)
end
end--//Exploit Check End
end)
I doubt it has anything to do with my code since it will not work in previous versions that are days old that I know for a fact worked beforehand. (It could be a roblox update as well.) If you have anything to point out to help, please do!