Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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!

1 comment

0

hey thanks sorry im really new to this whole coding stuff, thanks for the help!!

This discussion is preserved as it was. New answers, comments, and votes are closed.