I dont know how to add a script that reduce damage when blocking from a combat? [closed]
-- oh and im kinda new to this site
--ServerScriptServer BlockingSystem
local rp = game:GetService("ReplicatedStorage")
local Block = rp:WaitForChild("Block")
local Animations = script:WaitForChild("Animations")
local Meshes = script:WaitForChild("Meshes")
Block.OnServerEvent:Connect(function(player,isActive)
local Character = player.Character
local Humanoid = Character:WaitForChild("Humanoid")
01 | if isActive = = true then |
03 | local anim = Humanoid:LoadAnimation(Animations:WaitForChild( "Block" )) |
06 | local blockAction = Instance.new( "BoolValue" ,Humanoid) |
07 | blockAction.Name = "blockAction" |
09 | elseif isActive = = false then |
11 | for i, anims in pairs (Humanoid:GetPlayingAnimationTracks()) do |
12 | if anims.Name = = "Block" then |
17 | local blockAction = Humanoid:FindFirstChild( "blockAction" ) |
24 | Block:FireClient(player) |
end)
-- StarterPack Blocking
local Player = game:GetService("Players").LocalPlayer
local rp = game:GetService("ReplicatedStorage")
local Block = rp:WaitForChild("Block")
local UIS = game:GetService("UserInputService")
local isBroken = script.Parent:WaitForChild("isBroken")
local debounce = false
local isActive = false
local cd = 3
--/Press button
UIS.InputBegan:Connect(function(input,isTyping)
if isTyping then
return
elseif input.KeyCode == Enum.KeyCode.G then
if debounce == false and isBroken.Value == false then
if isActive == false then
isActive = true
1 | Block:FireServer(isActive) |
end)
--/Button let go
UIS.InputEnded:Connect(function(input,isTyping)
if isTyping then
return
elseif input.KeyCode == Enum.KeyCode.G then
if debounce == false and isBroken.Value == false then
if isActive == true then
isActive = false
debounce = true
1 | Block:FireServer(isActive) |
end)
Block.OnClientEvent:Connect(function()
wait(cd)
debounce = false
isActive = false
end)