You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want the for loop to work in the damage reciever -
What is the issue? Include screenshots / videos if possible!
the damage reciever doesn’t work and I noticed it when it stopped playing the hurt animations and etc. -
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
- going to previous working versions and replacing the scripts.
- reading over it again and again looking for the differences so I can figure out whats wrong but just can’t see it.
- devforum for loop problems but they didn’t help much.
- tried to see if the fighters tags were not being applied but they were.
This is the DamageReciever local script
local RS = game:GetService("RunService")
local CS = game:GetService("CollectionService")
local TS = game:GetService("TweenService")
local CharacterValues = require(game.ReplicatedStorage.Modules.CharacterValues)
local Fighters = CS:GetTagged("Fighter")
for _, Fighter in pairs(Fighters) do
local character = Fighter
local Humanoid = character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local HurtAnim = Animator:LoadAnimation(script:WaitForChild("HurtAnimation"))
HurtAnim.Priority = Enum.AnimationPriority.Action2
local BlockAnim = Animator:LoadAnimation(script:WaitForChild("BlockAnim"))
HurtAnim.Priority = Enum.AnimationPriority.Action4
local ParryAnim = Animator:LoadAnimation(script:WaitForChild("ParryAnim"))
HurtAnim.Priority = Enum.AnimationPriority.Action4
local oldHealth = Humanoid.Health
Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if Humanoid.Health > oldHealth then
oldHealth = Humanoid.Health print("Healed")
return
end
if Humanoid.Health > 1 and not character:GetAttribute("Parrying") and not character:GetAttribute("Blocking") then
local OriginalWS = CharacterValues.CharacterValues.WalkSpeed
Humanoid.WalkSpeed+= 3.5
oldHealth = Humanoid.Health
print("Damaged")
HurtAnim:Play(0.2)
TS:Create(Humanoid,TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {CameraOffset = Vector3.new(Random.new(3,-3),Random.new(3,-3),0)})
task.delay(1, function()
Humanoid.WalkSpeed = OriginalWS
end)
elseif Humanoid.Health > 1 and character:GetAttribute("Blocking") == true then
BlockAnim:Play(0.2,1)
elseif Humanoid.Health > 1 and character:GetAttribute("Parrying") == true then
ParryAnim:Play(0.2,1)
end
end)
end
I did probably modify other scripts which could have caused this.
But testing it a few times I did get to have the damage reciever work without it having to change a code.
I’m probably forgetting a rule about LUA or something idk
But right now I need feedback on what I could do to fix this problem would really help A LOT.