I’m trying to create a parrying system where if the player presses “F,” they will block any attack for a short amount of time. To do this, I created a module script that manages status effects and I added a “parrying” effect through the parry script. I have confirmed that the player does have the effect through another server script, but the 3rd script below somehow detects that the player doesn’t and the damage goes through. (FYI I’m new to scripting.)
Here’s the module script that checks if the player has a specific effect (sem stands for StatusEffectsManager and se stands for StatusEffects):
if se[player] == effectName then
return true
else
return false
Here’s the script that tests whether or not the player has the “parrying” effect (it shows a true output):
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
while true do
print(sem.CheckStatusEffect(plr, "parrying"))
task.wait(1)
end
end)
end)
And here’s the script that detects that the player somehow doesn’t have the effect:
if touched.Parent ~= plr.Character and touched.Parent:FindFirstChild("Humanoid") then
local ehum = touched.Parent.Humanoid
if hitdebounce then return end
if sem.CheckStatusEffect(touched.Parent, "parrying") then
ehum:TakeDamage(0)
else
ehum:TakeDamage(damage)
print(touched.Parent, sem.CheckStatusEffect(touched.Parent, "parrying"))
end
hitdebounce = true
end