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

Error on line 20 Expected <eof>, got 'end'?

Asked by 6 years ago
Edited 6 years ago

Line 20 Expected <eof>, got 'end'

Any fix to this? Can't seem to figure what is wrong.

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAppearanceLoaded:Connect(function(character)
    player.Chatted:Connect(function(msg)
        msg = msg:lower()
        if (msg == "money") then
            if (player.Character ~= nil) then
                local humanoid = character:WaitForChild("Humanoid")
                    if player.Name == "LoganboyInCO" then
                        humanoid:AddAccessory(game.ReplicatedStorage.moneyrain) 
                            end
                            humanoid.Died:Connect(function()
                                character:FindFirstChild("moneyrain").Parent = game.ReplicatedStorage
                                game.ReplicatedStorage.moneyrain:Clone()    
                            end)
                        end
                    end
                end)
            end)
        end)
    end)
end)

wow i hate autism

1 answer

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

functions with their structures defined as (function() have a parenthesis at the end, if statements have their code blocks end as end not end).

game.Players.PlayerAdded:Connect(function(player)
        player.CharacterAppearanceLoaded:Connect(function(character)
        player.Chatted:Connect(function(msg)
            local msg = msg:lower()
            if (msg == "money") then
                if (player.Character ~= nil) then
                    local humanoid = character:WaitForChild("Humanoid")

                        if player.Name == "LoganboyInCO" then
                            humanoid:AddAccessory(game.ReplicatedStorage.moneyrain) 
                         end

                                humanoid.Died:Connect(function()
                                   character:FindFirstChild("moneyrain").Parent = 
game.ReplicatedStorage
                                  game.ReplicatedStorage.moneyrain:Clone()    
                               end)
                           end
                       end
                   end
               end
         end)
    end)
end)
Ad

Answer this question