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

'end' expected (to close 'function' at line 6) near '<eof>'

Asked by 10 years ago
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>'

3 answers

Log in to vote
1
Answered by 10 years ago

You are missing two "end)"s for your connect lines.

0
Please explain more? Falcon2k12 0 — 10y
0
You didn't do an ordinary connection line. You did a Mass Connection line which most people think is much easier. If you can see in the line, It's missing ')' so at the last end, you have to add it there. Shawnyg 4330 — 10y
Ad
Log in to vote
0
Answered by
Azarth 3141 Moderation Voter Community Moderator
10 years ago

'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))

Log in to vote
0
Answered by
raid6n 2196 Moderation Voter Community Moderator
4 years ago
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
)

Answer this question