The script works perfectly in studio but in game it doesn't work when input has ended.

--//LOCAL SCRIPT:

--{(Local Script "Blocking"}}--
--{Input Started
UserInputService.InputBegan:connect(function(input, gameProcessed)
	if input.KeyCode ~= Enum.KeyCode.E then return end;
	if gameProcessed then
	else
		if CombatEnabled or EvadingEnabled == true then return end;
		if BlockingEnabled == false then
			BlockingEnabled = true
			BlockingValue.Value = true
			print("Blocking")
			--{RemoteEvent
			ReplicatedStorage.RemoteEvents.CombatEvents.BlockEvent:FireServer()
		end
	end
end)
--{Input Ended
UserInputService.InputEnded:connect(function(input, gameProcessed)
	if input.KeyCode ~= Enum.KeyCode.E then return end;
	if gameProcessed then
	else
		if BlockingEnabled == true then
			BlockingEnabled = false
			BlockingValue.Value = false
			print("Done blocking")
		end
	end
end)

--//SCRIPT:

--{{Script "Blocking}}--
--{While blocking value is true
ReplicatedStorage.RemoteEvents.CombatEvents.BlockEvent.OnServerEvent:connect(function(Player)
	--{Preset Animations
	local Animation = Player.Character.Humanoid:LoadAnimation(ReplicatedStorage.Animations.Combat.Block)
	local current = Animation
	--{Call Value
	local isBlocking = Player.Character.HumanoidRootPart.IsBlocking
	--{MAIN}--
	isBlocking.Value = true
	BlockingValue.Value = true
	Player.Character.Humanoid.WalkSpeed = Player.Character.Humanoid.WalkSpeed - 8
	while BlockingValue.Value == true and wait() do
		--{Animation
		current:Play()
		print(BlockingValue.Value)
		if BlockingValue.Value == false then
			Player.Character.Humanoid.WalkSpeed = Player.Character.Humanoid.WalkSpeed+8
			current:Stop()
		break end
	end
end)

Can I get some help?

2 comments

0

You didn't define "ReplicatedStorage".. does "Done Blocking" never print?

0

@Goulstem I defined ReplicatedStorage just now, and "Done Blocking" does not print while in game.