My punch script is spammable at 30 FPS. I have no idea why this is but here’s my code:
UIS.InputBegan:Connect(function(Input, gameprocessed)
if gameprocessed then return end
if Input.UserInputType == Enum.UserInputType.MouseButton1 then
if not equipped then return end
if M1CD then return end
local isStun = checkState:InvokeServer("Stun")
local isBlocking = checkState:InvokeServer("Blocking")
if isStun then return end
if isBlocking then return end
M1CD = true
currTime = tick()
local passedTime = currTime - prevTime
if passedTime < 1.5 then
count = count + 1
if count > 5 then
count = 1
end
else
count = 1
end
Combat:FireServer("Combo","None",count)
task.wait(0.25)
if char:FindFirstChild("Hitstun") then
M1CD = false
return
end
local Hitbox = Instance.new("Part",plr.Character)
Hitbox.Name = "PunchHitbox"
Hitbox.Massless = true
Hitbox.CanCollide = false
Hitbox.Size = Vector3.new(3.5,4,4)
Hitbox.Transparency = 1
Hitbox.BrickColor = BrickColor.new("Really red")
Hitbox.Material = Enum.Material.Neon
Hitbox.CFrame = char.HumanoidRootPart.CFrame
game.Debris:AddItem(Hitbox,0.12)
local HitBoxWeld = Instance.new("Weld",char.HumanoidRootPart)
HitBoxWeld.Part0 = char.HumanoidRootPart
HitBoxWeld.Part1 = Hitbox
HitBoxWeld.C0 = CFrame.new(0,0,-2.3)
local HitFolder = Instance.new("Folder",Hitbox)
HitFolder.Name = "HitFolder"
Hitbox.Touched:connect(function(Part)
if Part.Parent:FindFirstChild("Humanoid") and HitFolder:FindFirstChild(Part.Parent.Name) == nil and Part.Name == "Torso" and char:FindFirstChild("Humanoid") then
local GodBodyValue = Instance.new("ObjectValue", HitFolder)
GodBodyValue.Name = Part.Parent.Name
game.Debris:AddItem(GodBodyValue,.12)
Combat:FireServer("M1",Part.Parent,count)
end
end)
end
end)
Example: