local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=" game.Players.PlayerAdded:connect(function(player) player.chatted:connect(function(msg) local msg = msg:lower() if msg == "/e punch" then local animTrack = player.Character.Humanoid:LoadAnimation(animation) animTrack:Play() end
'end' expected (to close 'function' at line 6) near '<eof>'
You are missing two "end)"s for your connect lines.
'Please explain more'
Every functions needs an end, every anonymous function needs an end and a close parenthesis, because it's left open at the beginning;
:connect(function() end)
This coroutine is left open twice, therefore needs to have two closed parenthesis.
coroutine.resume(coroutine.create(function() end))
local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=" game.Players.PlayerAdded:connect( function(player) player.chatted:connect( function(msg) local msg = msg:lower() if msg == "/e punch" then local animTrack = player.Character.Humanoid:LoadAnimation(animation) animTrack:Play() end end ) end )