The attribute is being changed it just isn’t being utilized for some reason. I’ll send the Parry module with it too.
Server Sided Script:
task.spawn(function()
if char:GetAttribute("CanParry") then
-- Play Animation
--ParryShiverAnims[plr] = hum.Animator:LoadAnimation(WeaponsAnimationsFolder[currentWeapon].Blocking.ParryShiver)
--ParryShiverAnims[plr]:Play()
char:SetAttribute("Parrying", true)
char:SetAttribute("CanParry", false)
task.wait(1.3)
char:SetAttribute("Parrying", false)
else
task.wait(.6)
char:SetAttribute("CanParry", true)
end
if char:GetAttribute("Parried") then
char:SetAttribute("CanParry", true)
char:SetAttribute("Parried", false)
end
end)
This is the Module script:
local module = {}
-- Services
local RS = game:GetService("ReplicatedStorage")
local SS = game:GetService("ServerStorage")
local SoundService = game:GetService("SoundService")
local Debris = game:GetService("Debris")
-- Folders
local RSStorage = RS.Storage
local RSModule = RSStorage.Modules
local SSModule = SS.Modules
local Events = RSStorage.RemoteEvents
local WeaponSounds = SoundService.SFX.Weapons
local WeaponAnimsFolder = RSStorage.Animations.Weapons
-- Events
local VFXEvent = Events.VFX
-- SoundsModule
local SoundsModule = require(RSModule.Combat.SoundsModule)
local ServerCombatModule = require(SSModule.CombatModule)
local StunHandler = require(SSModule.MISC.StunHandlerV2)
local WeaponStats = require(SSModule.Weapons.WeaponStats)
-- Main Script
function module.BodyVelocity (parent, HRP, Knockback, stayTime)
local bv = Instance.new ("BodyVelocity")
bv.MaxForce = Vector3.new(math.huge,0,math.huge)
bv.P = 50000
bv.Velocity = HRP.CFrame.LookVector * Knockback
bv.Parent = parent
Debris:AddItem(bv,stayTime)
end
function module.Parrying(char, eChar, hitPos) -- echar is the one who we hit and the char is the one that attacked
if not eChar:GetAttribute("CanParry") then return end
print ("Parrying")
local currentWeapon = char:GetAttribute("CurrentWeapon")
local eHRP = eChar.HumanoidRootPart
local HRP = char.HumanoidRootPart
local WeaponStat = WeaponStats.getStats(currentWeapon)
local ParryPosture = WeaponStat.ParryDamage
local knockback = WeaponStat.Knockback
if char:GetAttribute("UsingCritical") then
print ("Critical Posture")
ParryPosture = WeaponStat.CriticalParryDamage
else
ParryPosture = WeaponStat.ParryDamage
end
char:SetAttribute("Blocking", char:GetAttribute("Blocking") + ParryPosture)
eChar:SetAttribute("Blocking", eChar:GetAttribute("Blocking") - ParryPosture /2)
if eChar:GetAttribute("Blocking") <= 0 then eChar:SetAttribute("Blocking", 0) end
if char:GetAttribute("Blocking") >= 100 then
print ("Enemy Has Been Guardbroken")
module.GuardBreak(char)
return
end
VFXEvent:FireAllClients("CombatEffects", RSStorage.VFX.Combat.Parry, hitPos, 3)
SoundsModule.PlaySound(WeaponSounds[eChar:GetAttribute("CurrentWeapon")].Blocking.Parry, eChar.Torso)
ServerCombatModule.stopAnims(char.Humanoid)
char.Humanoid.Animator:LoadAnimation(WeaponAnimsFolder[(char:GetAttribute("CurrentWeapon"))].Blocking.Parry):Play()
eChar.Humanoid.Animator:LoadAnimation(WeaponAnimsFolder[(eChar:GetAttribute("CurrentWeapon"))].Blocking.Parry2):Play()
StunHandler.Stun(char.Humanoid,.5,3,0)
StunHandler.Stun(eChar.Humanoid,.25,3,0)
module.BodyVelocity(HRP, HRP,-knockback, .2)
module.BodyVelocity(eHRP, eHRP,knockback, .2)
if char:GetAttribute("Parried") then
char:SetAttribute("CanParry", true)
end
task.wait(.5)
eChar:SetAttribute("Parried", false)
end