How to make a counter move in pvp game? like if u got attacked , it counter the damage too the player who attack you
Do you have an attack script that can do damage without the counter move? That would help as you can add to the script.
yep i made one
local hitbox = script.Hitbox:Clone()
hitbox.Parent = workspace
hitbox.CFrame = standrootpart.CFrame
local ignorelist = {}
deb:AddItem(hitbox,.6)
hitbox.Touched:Connect(function(hitpart)
if not hitpart:IsDescendantOf(char) then
if hitpart.Parent:FindFirstChild("Humanoid") then
local enemy = hitpart.Parent
local enemys = players:GetPlayerFromCharacter(enemy)
so it would go like this, if counter move active then check if any enemy hitboxes touching if not then return function and start cool down if there is then you wan to find the player that is attacking then get the enemy humanoid and do damage you can also play an animation tween or vfx if you want to pretty basic if you ask me
how to make it when character humanoid health changed connect function? i tried this
local connection
connection = char.Humanoid.Health.HealthChanged:Connect(function()
so you would have to use if statements so if humanoid health < maximum health
then you would create a function
i cant make it idk why can u gimme a example how to make that?
i would accept, my studio is broken
Once a player uses a counter move, give them an attribute called “Counter” (or whatever name you’d like) set to true
. Then, in your attack script, once you find an enemy to hit, check if they have an attribute called “Counter”. If that attribute is set to true
, either don’t damage the enemy or make the player attacking take the damage instead. It’s very easy to do really.