Hello, I am making a blocking system and while I was testing I saw that my animation didn’t stop, I also researched on the devforum but nothing is helping me. If anyone could know how to fix this I would appreciate it, there isn’t any error on the output by the way.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BlockingRemote = ReplicatedStorage:WaitForChild("Blocking Remote")
BlockingRemote.OnServerEvent:Connect(function(Player, Blocking)
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local blockValue = Character.Blocking
local Attacking = Character.Attacking
if Attacking.Value == true then return end
Attacking.Value = true
local Blocking = Humanoid:LoadAnimation(script.Animations.Blocking)
if Blocking then
Blocking:Play()
blockValue.Value = true
print("Started server blocking")
else
Blocking:Stop()
Blocking.Value = false
print("Stopped server blocking")
end
end)```
I’m pretty sure the issue is that you set the animation for blocking equal to ‘Blocking’ which overrides the Blocking parameter. So just change the name of the variable for the loaded blocking animation
You are creating the variable for “Blocking” each time you fire the remote hence why it doesn’t stop. Put
“local Blocking = Humanoid:LoadAnimation(script.Animations.Blocking)” above the OnServerEvent. Your if statement also doesn’t work because Blocking is never set to nil or false so the else wont work. You need to make your if statement as “if not Blocking.IsPlaying then” or “if not blockValue.Value then” instead of “if Blocking then” also in your else statement you mistake “Blocking” for “blockValue”
Then how would I make a variable for the humanoid if the animation variable is above the OnServerEvent. About the other things, they were right. It actually prints now but the animation still doesn’t stop.