--\LOCAL SCRIPT

--{(Local Script "Guarding"}}--
--{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 GuardingEnabled == false then
			GuardingEnabled = true
			GuardingValue.Value = true
			print("Guard")
				--{RemoteEvent
				ReplicatedStorage.RemoteEvents.CombatEvents.GuardHoldEvent:FireServer()
			while GuardingEnabled == true and wait() do
				print(GuardingValue.Value)
				if GuardingEnabled == false then
					GuardingEnabled = false
					GuardingValue.Value = false
				break end
			end
		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  GuardingEnabled == true then
			GuardingEnabled = false
			GuardingValue.Value = false
		end
	end
end)

--\SCRIPT

--{{Script "Guarding"}}--
--{Hold
ReplicatedStorage.RemoteEvents.CombatEvents.GuardHoldEvent.OnServerEvent:connect(function(Player)
	--{Animation
	local Animation = Player.Character.Humanoid:LoadAnimation(ReplicatedStorage.Animations.Combat.Guard)
	local current = Animation
	if GuardingValue.Value == true then
		current:Play()
		Player.Character.HumanoidRootPart.IsBlocking.Value = true
		repeat wait() until GuardingValue.Value == false
		if GuardingValue.Value == false then
			current:Stop()
			Player.Character.HumanoidRootPart.IsBlocking.Value = false
		end
	end
end)

ReplicatedStorage was identified, but while in studio it works perfectly but when it comes to actual in-game everything prints but the animation does not work like it should in studio, any help?

2 comments

0

You should be doing the animations in the local script. Animations are one the the things that do replicate with FE.

0

I'm confused at line 17. There was a if statement if that value is false, and now you're changing it to false?