Hello, I’m trying to make a block system (Server Script) where if you are blocking you can’t attack. Therefore, I created an attribute in the script so I could detect if the player is blocking or not. But, whenever I change the attribute it doesn’t show in the script’s property. Even though when it prints out it says it’s been changed. Any idea why this might be happening? Is it a bug?
Here’s the script:
function Block(player)
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator")
local Track = animator:LoadAnimation(script.Block)
if not blocking then
blocking = true
print("Blocking", blocking) -- Prints true
humanoid.WalkSpeed = 8
Track:Play()
elseif blocking then
blocking = false
print("Not Blocking", blocking) -- Prints false
humanoid.WalkSpeed = 16
Track:Stop()
end
if oldHealth == nil then
oldHealth = humanoid.MaxHealth
end
end
Here’s a video:
Thank you.