Hello, iv been trying to make a block for my sword but i dont know how i use a old model of a sword from roblox and i cant figure out how to make the block on this.
i have the animation for it i just dont under stand how to add the block to the sword in general to block attacks and also be able to play a animation
your help would be appreciated thanks
OH, my mistake I see. Iād recommend programming the sword to detect if a player is blocking via bool values parented by the sword, from there do less damage to the player.
You would also have to keep the de-bounce on until the player releases the block key.
-Assuming that the attacker also has a sword.
i get the bool values id have to make the problem im having is scripting the block script its self i dont under stand how to make it
You can reference the way this script I made works:
local human = script.Parent.Humanoid
local isblocking = true
local lastv = human.MaxHealth
human.Changed:Connect(function(property)
if isblocking == true then
if property == "Health" then
if human.Health < lastv then
local dif = (lastv - human.Health) /2
human.Health += dif
lastv = human.Health
end
end
end
lastv = human.Health
end)
what it does is detects when the humanoid takes damage and adds back half of what was taken.
-Change the human value to whatever the variable is for the humanoid.
-And make sure the isblocking value gets changed to true and false to enable it.
1 Like
thank you ill mark this as a solution
Alright, lmk if you have another issue with this.