In my fighting game, there is punch attack and hook. but if I hold weapon and use strong attack and then punch, punch becomes strong attack… (server says it’s punch but damage and effect is strong…) also it happens if I hold weapon only.
ex : do strong attack, hold stick and then punch then punch becomes strong attack damage
and if I don’t hold weapon, it won’t happen
It’s soooo complicated glitch and I can’t even know what is problem.
+there is one more glitch that when I hold planks and use strong attack, it just becomes normal punch
here are my scripts…
punch script (with planks)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local punch = Instance.new("RemoteEvent", ReplicatedStorage)
punch.Name = "Planks Hit"
local punchSound = script.punchSound
local function hitcheck(player)
print("planks")
local character = player.Character or player.CharacterAdded:Wait()
local weapon = character.Weapon
player.hitable.Value = true
if player.hitable.Value == true then
weapon.Touched:Connect(function(other)
if other:IsA("BasePart") then
if player.hitable.Value == true then
local humanoid = other.Parent:FindFirstChildWhichIsA("Humanoid")
if humanoid then
if player.pvpmode.Value == false then
if other.Parent.Parent == game.Workspace.clones then
player.hitable.Value = false
if weapon:FindFirstChild("punchSound") then
weapon.punchSound:Play()
else
local cloneSound = punchSound:Clone()
cloneSound.Parent = weapon
cloneSound:Play()
end
humanoid.Health = humanoid.Health - 20
end
else
if other.Parent.Parent == game.Workspace then
for _, v in pairs(game.Players:GetChildren()) do
if v.Name == other.Parent.Name then
if v.pvpmode.Value == true then
player.hitable.Value = false
if weapon:FindFirstChild("punchSound") then
weapon.punchSound:Play()
else
local cloneSound = punchSound:Clone()
cloneSound.Parent = weapon
cloneSound:Play()
end
if humanoid.Health <= 20 then
humanoid.Health = 0.01
else
humanoid.Health = humanoid.Health - 20
end
if weapon:FindFirstChild("punchSound") then
weapon.punchSound:Play()
else
local cloneSound = punchSound:Clone()
cloneSound.Parent = weapon
cloneSound:Play()
end
end
end
end
end
end
end
end
end
end)
end
end
punch.OnServerEvent:Connect(hitcheck)
strong attack script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local push = Instance.new("RemoteEvent", ReplicatedStorage)
push.Name = "Push"
local punchSound = script.punchSound
local function hitcheck(player)
local character = player.Character or player.CharacterAdded:Wait()
local weapon = character.RightHand
player.hitable.Value = true
if player.hitable.Value == true then
weapon.Touched:Connect(function(other)
if other:IsA("BasePart") then
if player.hitable.Value == true then
local humanoid = other.Parent:FindFirstChildWhichIsA("Humanoid")
if humanoid then
if player.pvpmode.Value == false then
if other.Parent.Parent == game.Workspace.clones then
player.hitable.Value = false
if weapon:FindFirstChild("punchSound") then
weapon.punchSound:Play()
else
local cloneSound = punchSound:Clone()
cloneSound.Parent = weapon
cloneSound:Play()
end
local otherRoot = other.Parent.HumanoidRootPart
local Force = Instance.new("BodyVelocity")
Force.Name = "Push Force"
Force.MaxForce = Vector3.new(10000000, 10000000, 10000000)
Force.Velocity = character.HumanoidRootPart.CFrame.lookVector * 80
Force.Parent = otherRoot
humanoid.Health = humanoid.Health - 15
wait(0.25)
Force:Destroy()
end
else
if other.Parent.Parent == game.Workspace then
for _, v in pairs(game.Players:GetChildren()) do
if v.Name == other.Parent.Name then
if v.pvpmode.Value == true then
player.hitable.Value = false
if weapon:FindFirstChild("punchSound") then
weapon.punchSound:Play()
else
local cloneSound = punchSound:Clone()
cloneSound.Parent = weapon
cloneSound:Play()
end
local otherRoot = other.Parent.HumanoidRootPart
local Force = Instance.new("BodyVelocity")
Force.Name = "Push Force"
Force.MaxForce = Vector3.new(10000000, 10000000, 10000000)
Force.Velocity = character.HumanoidRootPart.CFrame.lookVector * 80
Force.Parent = otherRoot
if humanoid.Health <= 15 then
humanoid.Health = 0.01
else
humanoid.Health = humanoid.Health - 15
end
wait(0.25)
Force:Destroy()
end
end
end
end
end
end
end
end
end)
end
end
push.OnServerEvent:Connect(hitcheck)
grab weapon script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local cngholdsword = Instance.new("RemoteEvent", ReplicatedStorage)
cngholdsword.Name = "Cngholdsword"
local function changevalue(player)
if player.holdsword.Value == false then
player.holdsword.Value = true
local character = player.Character or player.CharacterAdded:Wait()
local weapon = Instance.new("Part", character)
weapon.Name = "Weapon"
weapon.CFrame = character.RightHand.CFrame + character.RightHand.CFrame.LookVector * 1.75
local connecter = Instance.new("WeldConstraint")
weapon.Size = Vector3.new(0.25, 0.25, 5)
connecter.Name = "Weapon connecter"
connecter.Parent = weapon
connecter.Part0 = weapon
connecter.Part1 = character.RightHand
weapon.CanCollide = false
weapon.Color = Color3.fromRGB(226, 155, 64)
weapon.Material = "WoodPlanks"
--print("now holdsword is true")
else
player.holdsword.Value = false
local character = player.Character or player.CharacterAdded:Wait()
local weapon = character:FindFirstChild("Weapon")
weapon:Destroy()
--print("now holdsword is false")
end
end
cngholdsword.OnServerEvent:Connect(changevalue)