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

ServerScriptService.Combat:17: attempt to index nil with 'Humanoid' ?

Asked by 2 years ago
Edited 2 years ago

So, i'm making a combo script, and i'm trying to fix this issue i've been having for the last 30 minutes, it seems so simple but yet i cant find anyone else with the same issue. Here is my script:

local damage local AttackDebounce local plr = game.Players.LocalPlayer

game.ReplicatedStorage.CombatEvent.OnServerEvent:Connect(function(player,index) AttackDebounce = false local character = game.Workspace:WaitForChild(player.Name) if not character then return end

local AnimList = {
    "PunchLeft",
    "PunchRight",
    "Kick"
}

local animToPlay = script.Animations:FindFirstChild(AnimList[index])
local LoadedAnimation = cha racter.Humanoid:LoadAnimation(animToPlay)

LoadedAnimation:Play()

wait(1)

game.ReplicatedStorage.CombatEvent:FireClient(player)

end)

Its connected to a CombatCilent Script in StarterCharacterScripts, and that doesnt seem to be giving any errors. Can anyone help? (And no, the script doesnt start at local AnimList, im new to this website and Idk how to fix it. Also after game.ReplicatedStorage.CombatEvent.OnServerEvent:Connect(function(player,index) there is an indent for the rest of the script until end)

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

I think your problem is that in line 8 of the code block, you mistyped 'character' with 'cha racter' Try fixing that to be 'character' like this

local LoadedAnimation = character.Humanoid:LoadAnimation(animToPlay)

Before you post something check the spelling in your script and on the site to make sure everything is spelled correctly, its very important with coding.

Also, you seem to be confused with code blocks. At the top of posts theres a blue circle with 'lua' in it. Click it and put your code inside of the lines. Hope this fixes your problem!

0
hey thanks sorry im really new to this whole coding stuff, thanks for the help!! tumtindy 36 — 2y
Ad

Answer this question