BlockEvent.OnServerEvent:Connect(function(plr, isBlocking)
-- Variables
local Character = plr.Character
local Humanoid = Character.Humanoid
local blockAnim = Humanoid.Animator:LoadAnimation(blockAnimations[1])
local currSpeed = Humanoid.WalkSpeed
local currJump = Humanoid.JumpPower
print(currJump)
print(currSpeed)
if isBlocking then
print("Started Blocking")
blockAnim:Play()
Humanoid.WalkSpeed = 6
Humanoid.JumpPower = 6
print(currJump)
print(currSpeed)
local blockAction = Instance.new("NumberValue") blockAction.Parent = Humanoid
blockAction.Name = "blockAction"
blockAction.Value = 5
elseif not isBlocking then
print("Stopped Blocking")
print(currJump)
print(currSpeed)
Humanoid.WalkSpeed = currSpeed
Humanoid.JumpPower = currJump
-- Attempts to stop the blocking animation.
for i, anims in pairs(Humanoid:GetPlayingAnimationTracks()) do
if anims.Name == "Block" then
anims:Stop()
end
end
local blockAction = Humanoid:FindFirstChild("blockAction")
if blockAction then
blockAction:Destroy()
end
end
BlockEvent:FireClient(plr)
end)
So basically when you block for the first time, it saves the correct walkspeed and jump data, however, when you unblock, the remote event is fired again and will change the walkspeed/jump data values (currSpeed, currJump) to the blocking speed and I don’t want it to do that, any ideas?