I currently have a block script that does work in some cases but I feel as if it could be much more efficient. The script spawns a invisible brick in front of the player that serves as the means of blocking the way the player is facing. It works fine with my hand to hand combat script but when using a tool that has more reach than a fist, the attack just seems to phase right through the block as if it never touched it and damages the player. Should I be trying a different method of making of a block script or...?
COMMUNITY QUESTION
Any ideas on how to make a effective combat blocking script?
2 answers
My suggestion would be to make the humanoid invincible like DAsanicmaster said by using the HealthChanged event
local humanoid = character.Humanoid -- humanoid variable
humanoid.HealthChanged:Connect(function()
humanoid.Health = humanoid.MaxHealth
end)
You could do..
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local blocking = false
game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.R and not blocking then --Also, could be written as [[inputObject.KeyCode == "R"]]
blocking = true
local nodamage = Instance.new("ForceField", Character.Torso)
nodamage.Visible = false
wait(5)
nodamage:Destroy()
blocking = false
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Maybe post the scripts
You could probably just make the Player's Humanoid who is using the block invincible