Hi,

I keep getting this error:

Infinite yield possible on 'ReplicatedStorage:WaitForChild("Combat")'

My explorer: https://gyazo.com/11cffef31107fecec5f49deadc1570b1

PLR script:

local cp = game:GetService("ContentProvider")
local AnimFolder = script:WaitForChild("Animation")

warn("Loading")
cp:PreloadAsync(AnimFolder:GetChildren())
warn("Loaded")

CombatSystem script:

local RP = game:GetService("ReplicatedStorage")
local Combat = RP:WaitForChild("Combat")
local Animations = script:WaitForChild("Animation")

local anims =
{
	Animations:WaitForChild("Right"),
	Animations:WaitForChild("Left"),
	Animations:WaitForChild("Kick"),
}

Combat.OnServerEvent:Connect(function(player,count)
	local Character = player.Charcacter
	local Humanoid = Character:WaitForChild("Humaiod")
	
	local attack = Humanoid:LoadAnimation(anims[count])
	attack:Play()
	
	Combat.FireClient(player)
end)

Combat script:

------variables
local Player = game:GetService("Players").LocalPlayer
local RP = game:GetService("ReplicatedStorage")
local Combat = RP:WaitForChild("Combat")
local UIS = game:GetService("UserInputService")
local debounce = false
local CD = 0.5
local count = 0
local currTime = 0
local prevTime = 0
----------------

UIS.InputBegan:Connect(function(input, isTyping)
	if isTyping then
		return
	elseif input.UserInputType == Enum.UserInputType.MouseButton1 then
		if debounce == false then
			debounce = true
			currTime = tick()
			
			local passedTime = currTime - prevTime
			if  passedTime < 1 then
				count  = count + 1
				if count > 4 then
					count = 1
				end
			else
				count = 1
			end
			
			Combat:FireServer(count)
			
		end
	end
end)

Combat.OnClientEvent:Connect(function()
	prevTime = currTime
	wait(CD)
	debounce = false
end)

2 comments

0

But does everything work perfect?

0

the thing i want to do wont work because of this error its the only error