Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Click To Do Animation Script Is Unable To Work Because Of Error. Anyone Know How To Fix?

Asked by 3 years ago

When I use this click to run animation script I get this error(I'm working on a fighting game) The Error is 21:00:04.573 LoadAnimations is not a valid member of Humanoid "Workspace.LoneSpace_Ranger.Humanoid" - Server - CombatSystem:18

I cant fix it here is the combat script:

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 = .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 
                --Can Continue Combo
                count = count + 1
                if count > 4 then
                    count = 1
                end
            else
                --Restarts Combo
                count = 1
            end

            Combat:FireServer(count)

        end
    end
end)

Combat.OnClientEvent:Connect(function()
    wait(cd)
    debounce = false
end)

This Is The Combat System Script

local rp = game:GetService("ReplicatedStorage")
local Combat = rp:WaitForChild("Combat")

local Animations = script:WaitForChild("Animations")

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

Combat.OnServerEvent:Connect(function(player,count)
    local Character = player.Character
    local Humanoid = Character:WaitForChild("Humanoid")

    local attack = Humanoid:LoadAnimations(anims[count])
    attack:Play()

    Combat.FireClient(player)

end)

Thank You In Advance

1 answer

Log in to vote
0
Answered by
vra000 22
3 years ago
Edited 3 years ago

It's because there is no such thing as "LoadAnimations". There is only LoadAnimation. Maybe you can load each animation separately and do a quick 0.01 wait signal so you would only wait 0.04 seconds for all animations to play. It wouldn't make sense in this situation to use a table instead of a variable. Here is what I mean:


local rp = game:GetService("ReplicatedStorage") local Combat = rp:WaitForChild("Combat") local Animations = script:WaitForChild("Animations") Combat.OnServerEvent:Connect(function(player,count) local Character = player.Character local Humanoid = Character:WaitForChild("Humanoid") local attack = Humanoid:LoadAnimation(animations:WaitForChild("Kick")) local attack2 = Humanoid:LoadAnimation(animations:WaitForChild("Left")) local attack3 = Humanoid:LoadAnimation(animations:WaitForChild("Right")) local attack4 = Humanoid:LoadAnimation(animations:WaitForChild("Gut")) attack:Play() wait(0.01) attack2:Play() wait(0.01) attack3:Play() wait(0.01) attack4:Play() Combat.FireClient(player) end)

Hope this answered your question!

Ad

Answer this question