Hello devs,
Once again im asking for your support
Recently I decided to rewrite my combat system in my fighting game but i have come across a error claiming there is a infinite yield in my code about a kick animation
There is animations folder in the script with all my animations but says "Infinite yield possible in ServerScriptService.Combat_System.Animations:WaitForChild(“Kick”)
When its in there and has the exact name
Server Code
local rp = game:GetService("ReplicatedStorage")
local Combat = rp:WaitForChild("Combat")
local animations = script:WaitForChild("Animations")
local anims =
{
animations:WaitForChild("Right"),
animations:WaitForChild("Left"),
animations:WaitForChild("Kick"),
animations:WaitForChild("Heavy Attack"),
}
Combat.OnServerEvent:connect(function(player,count)
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local attack = humanoid:LoadAnimation(anims[count])
attack:Play()
Combat:FireClient(player)
end)
Client Code
local player = game:GetService("Players").LocalPlayer
local rp = game:GetService("ReplicatedStorage")
local Combat = rp:WaitForChild("Combat")
local UIS = game:GetService("UserInputService")
local Mouse = player:GetMouse()
local debounce = false
local cd =.25
local currtime = 0
local prevtime = 0
local count = 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()
wait(cd)
debounce = false
end)
Thanks for reading
~Neptune